Oreo hot-fix for Google’s target API level requirement

Shaily Sahoo
Technology at Nineleaps
3 min readFeb 1, 2019
Android Oreo 8.1 logo

Google Play requires new apps and updates target at least Android 8.0 (API level 26) from August 1, 2018. This is a huge mandate for all the android developers and android application focused businesses. To start with, you need to be alert about the latest fixes and version clashes in your customized application. Apart from this, I am going to share some do’s and don’ts for each step.

To make it understandable I have described scenarios where you need to focus when you change your targetSdkVersion to 26 i.e Oreo.

  1. Migration of Google Cloud Messaging (GCM) to Firebase Cloud Messaging (FCM)

Using the instructions in this guide you can seamlessly migrate an existing GCM client app on Android to FCM. Although, before getting started, keep in mind a couple of points and few standard practices:

  • GCM and FCM SDKs cannot co-exist within an application
  • GCM tokens retrieved via GoogleCloudMessaging.register() or InstanceID.getToken() will continue to work in FCM without any modification or renewal

Do’s

  • Try to keep the gradle version of FCM above 10.2.1, the most stable version for any customized application is 11.2.0 or 11.4.0.
  • Make notification channels for android Oreo and above.
  • Existing google-services.json file won’t work, therefore try to make a json file, connected to firebase cloud messaging service.

Don’t

  • Avoid changing the code before making modifications to json.

2. Implementation of notification channels for Oreo and above

Android 8.0 includes notification channels that allows users to customize channel for individual notifications they want to displayed. Notification channels allow you to create a user-customizable channel for each type of notification you want to display. For each channel, you can set the visual and auditory behavior that is applied to all notifications in that channel. So, create NotificationChannel object and set it to createNotificationChannel(…) setter property of NotificationManager in case the android version is greater or same as 8.0.

3. Auto backup may result in app crashing for higher versions

Apps that target Android 6.0 (API level 23) or higher by default have auto backup feature. In your app manifest file, set the boolean value to true or false for android:allowBackup and android:fullBackupContent to enable or disable backup. The default value is true.

4. Downloading notification for Oreo and above

Apps that target Android 8.0 (API level 26) or higher do not send download notification automatically. All notifications must be assigned to a channel. That means, we need to implement notification channel to get download notification service in Oreo and above.

These are few tailored and behavioral changes that can fix all the custom applications with features mentioned in the post. If you are targeting to migrate to Android Oreo and above, I would suggest, you closely follow all the steps to make your code error- free and crash-free. These fixes can not only help solve the issue but also save significant time and effort.

If you liked the article or you have some other suggestions to add to it, please like, share or drop in a word in the comments section. I would love to hear from my readers.

--

--