Develop hybrid applications for Android
Develop hybrid applications for Android as detailed here.
When Android runs in debuggable mode, which can be set in the application's manifest file, unintended consequences can occur. One consequence is that SSL errors are not displayed by Cordova, such as when the server certificate is not trusted.
Important: When building an Android application for deployment to a production environment, do not build it to run in debuggable mode. Ensure that the AndroidManifest.xml file does not include an android:debuggable attribute, or set its value to false. See Configure Your Application for Release.
If we are targeting devices on API level below 14, add the following permission to the AndroidManifest.xml file: <uses-permission android:name="android.permission.GET_TASKS"/>. This permission is required for the heartbeat functionality to function properly.
- Understand the Default startup process in Android-based Hybrid applications
By default, the MobileFirst framework is initialized to display a web view in the Android-based hybrid application. The default startup process for Android-based hybrid applications is described here.
- Implementing a custom startup process in Android-based hybrid applications
We can display a native page when you start an Android-based hybrid application.
- Specify the icon for an Android application
Put the icon in the application's /android/nativeResources/res folder. It is copied from there at build time.
- Add custom code to an Android app
Adding custom code to the Android app in the onCreate method is deprecated. To add custom code to the Android app, use the onWLInitCompleted method.
- Extracting a public signing key
Copy the public signing key from the keystore to the application descriptor.
- Manage device orientation
When we develop Android applications that target an API level equal or higher than 13, we must include the screenSize value to the android:configChanges attribute in the AndroidManifest.xml file. Otherwise, the application fails to run properly when the device orientation changes.
- Build Android applications with Android Studio
From MobileFirst Studio, point to the directory containing the Android Studio installation, and run the Android application as an Android Studio project.
Parent topic: Develop hybrid applications