MobileFirst Platform Foundation compatibility for Android N

Update: The JSONStore issues on Android N are addressed in the following iFixes

Android N Google has rolled out the final version of Android 7.0 Nougat.

Android 7.0 has a whole bunch of new features like Multi-window support, Notification enhancements, Doze on the go, Data Saver.

MobileFirst Platform Foundation v6.3 to v8.0 has embraced Android 7.0 very well. A bunch of powerful features like adapter based authentication, custom authentication, form based authentication, invoking adapter procedures, application management, direct update, push notification that are offered by the MobileFirst Platform Foundation has been verified to work without any issues on the final version of Android 7.0. A sanity check has been performed to ensure that all the existing native Android and hybrid apps built on Android Marshmallow work on Android Nougat platform.

We encourage you to start testing your application(s) with Android N. Please see IBM MobileFirst Platform Foundation’s support plan for Android 7.0.

Known Issues

JSONStore API

The MobileFirst Platform Foundation’s JSONStore API does not work as expected on Android N, with the behavior changes introduced in Android N for NDK applications. The change in Android N is to remove support for linking against non-public APIs. This requires an update to the SQLCipher library used in the MobileFirst Platform Foundation’s JSONStore library. More details on the changes to the SQLCipher library can be found here.

Cordova with Android N

  • Android 7.0 does not allow the file:// protocol to be used externally from the scope of the app. The error occurs when sharing file URIs across Intent.Even though other plugins use the file URIs, such as File plugin, out of the core Cordova plugins, only the camera plugin uses the Cross-Process communication of sharing file URIs. Hence the FILE_URI and NATIVE_URI destination type of the Cordova camera plugin throws an android.os.FileUriExposedException. For updates on these issue please follow this thread.

  • Multi-Window Support is the big new feature of Android N and one that presents some minor problems for existing Cordova apps. When apps that are compiled with the pre-N SDK are put into multi-window mode, the user gets a message saying “App may not work in multi-window mode”. Cordova apps definitely fall into the non-working category because they tend to either crash or randomly restart when placed into multi-window mode. More information here.

Handling Secure Connections

Android Nougat has changed how Android handles trusted certificate authorities (CAs) to provide safer defaults for secure app traffic.Custom CAs are typically used in test environments and B2B apps. Apps that target API Level 24 and above no longer trust user or admin-added CAs for secure connections by default, more details here.

In order to allow your MobileFirst Platform Foundation app to trust user-added CAs for all secure connections the following needs to be done:

  1. Create network_security_config.xml under res/xml/ with the following content

     <?xml version="1.0" encoding="utf-8"?>
         <network-security-config>
         <base-config>
             <trust-anchors>
                 <certificates src="@raw/name of the .crt file"/>
                 <certificates src="user"/>
             </trust-anchors>
         </base-config>
     </network-security-config>
    
  2. Include the following under the Application tag in the AndroidManifest.xml file:

     android:networkSecurityConfig="@xml/network_security_config"
    

    The resulting should look like this:

     <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="sample.com.pincodeandroid">
    
         <uses-permission android:name="android.permission.INTERNET"/>
         <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    
         <application
             android:networkSecurityConfig="@xml/network_security_config"
             android:allowBackup="true"
             android:icon="@mipmap/ic_launcher"
             android:label="@string/app_name"
             android:supportsRtl="true"
             android:theme="@style/AppTheme"
             android:name=".PinCodeApplication">
             <activity android:name="com.worklight.wlclient.ui.UIActivity" />
             <activity android:name=".MainActivity">
                 <intent-filter>
                     <action android:name="android.intent.action.MAIN" />
                     <category android:name="android.intent.category.LAUNCHER" />
                 </intent-filter>
             </activity>
         </application>
     </manifest>
    
  3. Finally, copy the custom certificate (.crt) file into /res/raw folder

    copy-custom-ca-raw-folder

Stay tuned for more updates.

Last modified on October 19, 2016
Share this post: