IBM Support

IBM Worklight and Good Dynamics Integration

Product Documentation


Abstract

IBM and Good Technology have partnered to ensure that applications developed using IBM Worklight mobile application platform can now be deployed in the Good Dynamics container. This support is specific to the Apple iOS platform and available with IBM Worklight and the Good Dynamics Phonegap plug-in.

Content

This integration enables existing Good Technology and Worklight customers to use the Good Dynamics management of all communications between a Worklight application on the mobile client and the Worklight Server. It utilizes the encryption, data security, and network security of the Good container on the device to accomplish this integration. A developer downloads the PhoneGap plug-in from Good Dynamics Network (https://developer.good.com). Detailed instructions on performing the integration to leverage this feature are as available for the following operating systems:


Google Android




Note: For Google Android, Good Technology and Worklight integration currently only works for Worklight V6.2 and later versions.
  1. Create a Worklight hybrid application and create an Android environment. For instructions, see the IBM Worklight V6.1.0 Getting Started presentation.

  2. Download and install the Good Dynamics Software Development Kit (SDK) for Android. After you download the SDK, follow the readme file, which is included with the SDK, to install it.

  3. Download the Good Dynamics PhoneGap plugin.

  4. Add permissions to the AndroidManifest.xml file. See the following code:
     <!-- Good Permisions -->
    <uses-permission android:name="android.permission.CAMERA"/>  
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.RECORD_VIDEO"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <uses-permission android:name="android.permission.BROADCAST_STICKY"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.CAMERA"/>  
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.RECORD_VIDEO"/>
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    <uses-permission android:name="android.permission.READ_CONTACTS"/>
    <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
    <uses-permission android:name="android.permission.BROADCAST_STICKY"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

  5. Modify the activity tag. Add android:alwaysRetainTaskState="true" to your main activity.

  6. Copy the ${ANDROID_SDKDIR}/sdk/extras/android/support/v4/android-support-v4.jar file and add it to the build path.

  7. Add settings.json to the asset folder. The settings.json file should contain the following content:
    {
    "GDLibraryMode": "GDEnterprise",
    "GDApplicationID":"applicationPackage",
    "GDApplicationVersion":"1.0",
    "GDConsoleLogger": [
       "GDFilterErrors_",
       "GDFilterWarnings_",        
       "GDFilterInfo_",
       "GDFilterDetailed_",
    ]
    }

  8. Copy the gdcordova-3.x-1.5.9.jar file to your project build path.

  9. Include the GDInternalActivity library project. After you have installed the Good Dynamics SDK for Android, the project is located in the ${ANDROID_SDKDIR}/sdk/extras/good/dynamics_sdk/libs/gd directory.
    1. Import the GD directory as an Android project. The GDInternalActivity library project will exist in the workspace.

    2. Add the GDInternalActivity to the Java™ Build Path under the Projects tab of your Worklight Hybrid Application Android project.

  10. Remove android:launchMode="singleTask" from the AndroidManifest.xml file.

  11. Create an Activity named IccReceivingActivity with the following content:
    package APPLICATION_PACKAGE;

    import com.good.gd.GDIccReceivingActivity;

    public class IccReceivingActivity extends     GDIccReceivingActivity {
    }

  12. Modify the Manifest file and add the Good service and Activities. See the following code:
    <!-- GD builtin Activity and Service -->
       <activity android:name="com.good.gd.ui.GDInternalActivity"/>

       <!-- GD feature App Kinetics required components -->
       <activity
               android:name="com.good.gt.ndkproxy.icc.IccActivity"
               android:exported="true"
               android:alwaysRetainTaskState="true"
               android:theme="@android:style/Theme.NoDisplay">
           <intent-filter>
               <action android:name="com.good.gd.intent.action.ACTION_ICC_COMMAND"/>
           </intent-filter>
       </activity>

       <!-- Main GD Service -->
       <service
               android:name="com.good.gd.service.GDService"
               android:enabled="true"
               android:exported="false"/>

       <activity
               android:name="com.good.gd.GDIccReceivingActivity"
               android:exported="true"
               android:alwaysRetainTaskState="true">
           <intent-filter>
               <action android:name="com.good.gd.intent.action.ACTION_ICC_COMMAND"/>
           </intent-filter>
       </activity>

       <service
               android:name="com.good.gt.ndkproxy.icc.IccManagerService"/>


  13. Add the Good plugins to the config.xml file. See the following code:
    <!--  GOOD Plugins -->
    <feature name="GDApplication">
       <param name="android-package" value="com.good.gd.cordova.plugins.GDApplicationPlugin" />
    </feature>

    <feature name="GDStorage">
       <param name="android-package" value="com.good.gd.cordova.plugins.GDStoragePlugin" />
    </feature>

    <feature name="GDInterAppCommunication">
       <param name="android-package" value="com.good.gd.cordova.plugins.GDInterAppCommunicationPlugin" />
    </feature>

    <feature name="GDSocket">
       <param name="android-package" value="com.good.gd.cordova.plugins.GDSocketPlugin" />
    </feature>

    <feature name="GDSQLite">
       <param name="android-package" value="com.good.gd.cordova.plugins.database.GDSQLitePlugin" />
    </feature>

    <feature name="GDFileTransfer">
       <param name="android-package" value="com.good.gd.cordova.plugins.GDFileTransferPlugin" />
    </feature>

    <feature name="GDTokenHelper">
       <param name="android-package" value="com.good.gd.cordova.plugins.GDTokenHelperPlugin" />
    </feature>

    <feature name="GDPush">
       <param name="android-package" value="com.good.gd.cordova.plugins.push.GDPushPlugin" />
    </feature>

    <feature name="GDAppKinetics">
       <param name="android-package" value="com.good.gd.cordova.plugins.appkinetics.GDAppKineticsPlugin" />
    </feature>

    <feature name="GDHttpRequest">
       <param name="android-package" value="com.good.gd.cordova.plugins.GDHttpRequestPlugin" />
    </feature>

  14. Change the parent activity to GDCordovaActivity. See the following code:
    public class AndroidInt extends GDCordovaActivity implements WLInitListener {

    ............

    }

Apple iOS



Note: For Apple iOS, Good Technology and Worklight integration currently only works for Worklight V6.0 and later versions.

  1. Create a Worklight Hybrid Application and create an Android environment. For instructions, see the IBM Worklight V6.1.0 Getting Started presentation.

  2. Download and install the Good Dynamics SDK for iOS. After you download the SDK, follow the readme file, which is included with the SDK, to install it.

  3. Download the Good Dynamics PhoneGap plugin.

  4. Link and integrate the GD libraries with the plugin. Start by linking and integrating the GD libraries and frameworks from the SDK with your PhoneGap application. Complete the following steps:
    1. Open the Xcode project for your application.

    2. Select the target and click Build Phases.

    3. Open the Link Binary With Libraries menu.

    4. Add the following libraries and frameworks, if they are not already included, to the project by clicking the plus sign at the bottom of the drop-down list to browse and select them.
      • libz.dylib
      • libstdc++.dylib
      • GD.framework
      • GDCordova.framework
        Note: This framework is included with the Good Cordova Plugin download. Click Add Other to locate it.
      • SystemConfiguration.framework
      • Security.framework
      • CoreTelephony.framework
      • CoreData.framework
      • QuartzCore.framework
      • CFNetwork.framework
      • AdSupport.framework
      • MobileCoreServices.framework

  5. Bundle the GD resources. Complete the following steps:
    1. Select the GD.framework in the Project Navigator pane and right click to show the context menu.

    2. Click Show in Finder.

    3. Drag the GD.framework/Resources/GDAsset.bundle from the Finder into the Copy Bundle Resources build phase.

  6. Add the required linker flag
    In order for the PhoneGap Framework to properly load the GD plugin classes, you must add a linker flag to your project target. The following steps are only needed if the linker flag is not already used:
    1. Select your application target and select the Build Settings tab.

    2. Search for “Other Linker Flags”.

    3. Add the following linker flag: -ObjC

  7. Be sure to include the GDAppDelegate files (.h and .m) in your project. The GDAppDelegate must be a subclass of your primary application delegate class. Typically, this file is the AppDelegate class and the GDAppDelegate class inherits from AppDelegate.




    When the application launches, the application:didFinishLaunchingWithOptions: method for GDAppDelegate is called instead of your method for AppDelegate. This scenario is a requirement and allows the GD framework to enforce any authentication or authorization policies that are established for this application. Upon successful login, the onAuthorise: method for the application is called from the GDAppDelegate class and control is passed back to your primary AppDelegate. Therefore, the following code changes should be made in your AppDelegate class:
    1. Rename your application:didFinishLaunchingWithOptions: method to appStart:withOptions:. Other than the name change, the method signature remains the same as shown in the following code excerpt:
      -(BOOL) appStart:(UIApplication*)application withOptions:(NSDictionary*)launchOptions;


      The following screen shot shows the AppDelegate.h file with the appStart method:


    2. Rename the methods in the AppDelegate.m file as shown here:


  8. Modify the GDAppDelegate.m file by completing the following steps:
    1. Edit the GD AppID and Version strings in the GDAppDelegate.m file.



      The values for these strings must match the values that were used to register this GD application in the Good Control console (GC). The application ID does not necessarily need to match your bundle identifier; however, it is a good practice to use the same value.

    2. Change the function call from [gdLibrary authorize]; to [gdLibrary authorise:kappId andVersion:kappVersion];

  9. Add the -fobjc-arc flag to the GoodAppDelegate class in Build Phases> Compile Sources. Complete the following steps:
    1. Select your application target and select the Build Phases tab.

    2. Expand the Compile Sources section.

    3. Select the GDAppDelegate.m file.

    4. In the "Compiler Flags" field, add -fobjc-arc.

  10. Modify the main.m file. Edit your main.m file and replace your existing code with the following code:
    int main(int argc, char* argv[]){      int retVal = 0;     #if !(__has_feature(objc_arc))     NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];#else     @autoreleasepool {#endif     [GDiOS initialiseWithClassConformingToUIApplicationDelegate:[GDAppDelegate class]];     retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([GDAppDelegate class]));     [GDiOS finalise];#if !(__has_feature(objc_arc))     [pool release];#else     }#endif     return retVal;}


    Be sure to include the required import statements as shown below:


  11. Include the plugin JavaScript file in your project. Add the GoodDynamics.js file to your www folder as detailed in the following steps:
    1. Right-click the index.html file in your www folder and click Show in Finder.

    2. Copy the GoodDynamics.js file to your www folder, which is displayed in the Xcode project explorer.

  12. Reference the GoodDynamics.js file in your index.html file. Add a script tag to reference the GoodDynamics.js file from your index.html file.


    Note: The reference to GoodDynamics.js must come after the reference to the cordova-x.x.x.js file.




  13. IBM Worklight only: Add the URL type key-value pairs.


    Note: The instructions in this section only apply to applications that incorporate the IBM Worklight framework.


    Add the URL type name and value pairs to the .plist file of your project. Insert the following section into your application .plist file under the <dict> tag. Note: You need to modify the content to match your own application information.
    <key>CFBundleURLTypes</key>
     
    <array>
         
    <dict>
           
    <key>CFBundleURLSchemes</key>
                <array>
                 
    <string>com.good.gd.discovery</string>
                  <string>
    ${BUNDEL_IDNETIFIER_OF_YOUR_APP}.sc</string>
                 
    <string>${BUNDEL_IDNETIFIER_OF_YOUR_APP}.sc2</string>
               </array>
            <key>
    CFBundleURLName</key>
            <string>
    ${BUNDEL_IDNETIFIER_OF_YOUR_APP}</string>
         </dict>
      </array>


  14. Add the following plugin name/value pairs to your PhoneGap config.xml file.

  15. KeyValue
    GDHttpRequestGDCHttpRequestPlugin
    GDSocketGDCSocketPlugin
    GDPushGDCPushPlugin
    GDApplicationGDCApplicationPlugin
    GDDocumentsGDCDocumentsPlugin
    GDStorageGDStoragePlugin
    GDFileTransferGDCFileTransferPlugin
    GDSQLiteGDCSQLitePlugin



The plugin mappings must be added under the <plugins> tag of the config.xml file in your the project folder for the Cordova-iOS application. For simplicity, you can copy the following code under the <plugins> tag:
<feature name="GDHttpRequest">
    <param name="ios-package" value="GDCHttpRequestPlugin" />
</feature>
<feature name="GDSocket">
  <param name="ios-package" value="GDCSocketPlugin" />
</feature>
<feature name="GDPush">
   <param name="ios-package" value="GDCPushPlugin" />
</feature>
<feature name="GDApplication">
  <param name="ios-package" value="GDCApplicationPlugin" />
</feature>
<feature name="GDDocuments">
    <param name="ios-package" value="GDCDocumentsPlugin" />
</feature>
<feature name="GDStorage">
     <param name="ios-package" value="GDCStoragePlugin" />
</feature>
<feature name="GDFileTransfer">
    <param name="ios-package" value="GDCFileTransferPlugin" />
</feature>
<feature name="GDSQLite">
    <param name="ios-package" value="GDCSQLitePlugin" />
</feature>

Original Publication Date

20 June 2014

[{"Product":{"code":"SSZH4A","label":"IBM Worklight"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Security","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"6.2;6.1;6.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SS4HGH","label":"IBM Mobile Foundation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Security","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"6.0","Edition":"Consumer;Enterprise","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
19 August 2022

UID

swg27038743