Enabling a Cordova app to support Android SDK version 23 permissions

You might need to update some items to support permission handling for your IBM MobileFirst™ Platform Foundation version 7.1 Apache Cordova applications that target Android SDK version 23 and request permissions at runtime.

About this task

The original version of the IBM MobileFirst Platform Foundation version 7.1 did not support permission handling for Android SDK version 23. Enabling this support required some changes to the cordova-android platform and the following Cordova core plug-ins that are included with IBM MobileFirst Platform Foundation:
  • Camera
  • Contacts
  • File
  • Media
  • Media-capture

To enable this support in your third-party Cordova plug-ins, complete the following steps:

Procedure

  1. Update your third-party Cordova plug-ins to a version that supports requesting permissions at runtime.
  2. Add the PermissionHelper.java file. This file is a dependency for any plug-in that uses the Android SDK version 23 permissions. If you do not have any third-party Cordova plug-ins that depend on permissions, then you do not need to add the PermissionHelper.java file.
    1. Create an org.apache.cordova package.
    2. Download the PermissionHelper.java file from the Apache cordova-plugin-compat GitHub repository at: https://github.com/apache/cordova-plugin-compat/blob/master/src/android/PermissionHelper.java.
    3. Add the PermissionHelper.java file into the package directory that you created in step 2.a. You only need to add the PermissionHelper.java file to your project once, even if you have more than one third-party plug-in.