+

Search Tips   |   Advanced Search

Copy files of Native API applications for Android

To copy the files in the Native API application for Android into the project that defines the native app for Android

To use the MobileFirst Native API for Android in the native app, copy the library and the client property file of the Native API application into your native app for Android project.

In the project for the native app for Android:

  1. Copy the worklight-android.jar file, the android-async-http.jar file, the bcprov.jar file, and the uicandroid.jar file from the Native API application, and paste them into the libs folder of the native app for Android.

  2. Copy the wlclient.properties client property file from the Native API application into the assets folder of the native app for Android.

  3. If the push notification support is required:

    1. Copy the gcm.jar file from the Native API application.

    2. Paste the gcm.jar into the libs folder of the native app for Android.

    3. Copy the push.png file from the Native API application.

    4. In the res folder of the native app for Android, identify the folders with a name that starts with drawable (such as res/drawable or res/drawable-ldpi), and then paste the push.png file into each of these folders.

  4. Add the following lines to the AndroidManifest.xml file of the native app for Android:

    1. <activity android:name="com.worklight.wlclient.ui.UIActivity"/> With this line, a designated MobileFirst UI activity can run in the user application.

    2. <uses-permission android:name="android.permission.INTERNET"/> This line adds Internet access permissions to the user application.

    3. <uses-permission android:name="android.permission.GET_TASKS"/> This line adds the permission to get a list of running tasks required for the heartbeat functionality. This permission is required if you are targeting the apps for Android API level 13 and below.

    4. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

  5. If push notification support is required, add the following permissions to the AndroidManifest.xml file of your native app for Android:

    1. <uses-permission android:name="com.worklight.androidnativepush.permission.C2D_MESSAGE"/>

    2. <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

    3. <uses-permission android:name="android.permission.WAKE_LOCK"/>

    4. <uses-permission android:name="android.permission.GET_ACCOUNTS"/>

    5. <uses-permission android:name="android.permission.USE_CREDENTIALS"/>

    6. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

  6. Optional: If JSONStore is required, copy the contents of the jsonstore/assets/ and jsonstore/libs/ folders into the application's assets/ and libs/ folders, respectively.

  7. Manage the splash screens: In the res folder of the native app for Android, identify the folders with a name that starts with drawable (such as res/drawable or res/drawable-ldpi), and then:

    1. To use a splash screen in the app, we must create a splash.png file or splash.9.png file and place it in each of these folders.

    2. If we do not want to use a splash screen in the app, ensure that no splash.png file or splash.9.png file is present in these folders.

    If we create a hybrid Android app, the splash.9.png file is automatically created. If we do not want to use the splash screen in the app, we must delete it from these drawable folders.

  8. Optional: If app authenticity is required, copy the armeabi\libauthjni.so, armeabi-v7a\libauthjni.so, mips\libauthjni.so, and x86\libauthjni.so folders into the application's libs/ folder.


Parent topic: Develop native applications for Android