Google recently announced that as of August 2021, all new Android Native Mobile apps that are published to the Google Play Store must comply with Android API 30, and as of November 2021, updates to Android apps must also comply.
The reason behind this is:
“Every new Android version introduces changes that bring significant security and performance improvements as well as enhance the user experience of Android overall. Some of these changes only apply to apps that explicitly declare support through their targetSdkVersion manifest attribute (also known as the target API level).
Configuring your app to target a recent API level ensures that users can benefit from these improvements, while still allowing it to run on older Android versions. Targeting a recent API level also allows your app to take advantage of the platform’s latest features to delight your users. Furthermore, as of Android 10 (API level 29), users see a warning when starting an app for the first time if the app targets Android 5.1 (API level 22) or lower.”
Android App Bundles
Google also announced that new apps should use app bundles for (new) Play store publications. Note that this has already been supported by Mendix since March 2021 as part of the UI when building your mobile app, so no action needed for the App Bundles requirement. You only need to have the “Also build an Android App Bundle)” toggle turned on. Note that this setting is only available if you have configured your Android certificates.
Read more about App Bundles here.
What does this mean for me?
This section will explain what this means for existing projects and apps.
There is no action required:
- If you’ve created a new app with Mendix 9.4 or newer
- If you don’t build native apps for Android
If the two reasons above do not apply, then you’ll have to take the steps as outlined in the following two sections:
There is only some urgency if you plan to release a new app to the Google Play Store. If you’ve already published an app to the app store, you have until November 2021 to address this.
1. Update Native Mobile Resources module
One feature that is affected is the Take Picture action, because the underlying technology is updating to meet the new guidelines.
To update this action, download the latest version of the Native Mobile Resources module from the Marketplace. Note: If you are using 9.4 or later you will get a consistency error if you are using an older version. This module is available for Mendix 8.18 and 9.0.5 and higher
For Mendix 8, users were recommended to use the LTS version (Mendix 8.18). However, if you cannot upgrade yet to 8.18.0 or later, you can download the action as a separate document and import it into your project.
Migrating the Take Picture action.
In the updated version there is no option to select a picture from Camera or Image Library out of the box. You will need to pass this as a parameter if you use the Take Picture action.
If you want users to have the option to select from Camera or Image library, one can model this, for example, using bottom sheet widget (also part of Native Mobile Resource module). You can find an example in the Atlas Design System App under Atlas_DesignSystem > NativeMobile > NanoflowActions > NativeMobileResources > Take Picture.
Note that if you do not update the take picture action, it will stop working in the Make It Native App.
2. Build a new version of your native mobile app
There are two approaches for updating your native mobile app. The automated approach is advised for most users. However, for advanced users and for some cases a manual update might be preferred.
The standard approach for building a new version of your native mobile app to comply with the new guidelines, is to open the UI for building your app via (App/Project → Build Native Mobile App) in Studio Pro. The UI will ask to automatically update your app source (NativeTemplate). Say “yes” to the update question and your updated app source will automatically meet the requirements. Note that if you have made manual changes to your app source (NativeTemplate), you might need to apply them. The update is done using a single commit, so from there you can see the finished changes.
Manual approach (advanced)
If you want to manually update the version without touching other things, follow these steps. Please note that this is a more advanced approach. If you’re unsure of how to do this, the automated approach might be better.
1. Update the package.json
2. Delete the file patches/react-native-image-picker+2.3.4.patch
1. Update the targets in the android/build.gradle file
1. Update the ios/Podfile
1. Update package.json
1. Update android/settings.gradle
2. Update the android/app/build.grade
3. Update the targets in the android/build.gradle file
1. Update the ios/Podfile