Remember, Remember… to target API 26 on November!
It’s been a while since the Android team announced that all existing apps updates must target API level 26 (or higher) by November this year, otherwise we won’t be allowed to upload APKs to the Play Store.
The reason? To deliver more performant and secure applications to end users and enhance user experience.
Most app developers have been keeping their apps updated year by year. If you are not one of them, don’t worry, here is a brief checklist that may help you in your journey to API level 26!
Upgrading targetSdkVersion to 23 — Marshmallow
Android Marshmallow brought two major changes to be considered by developers: The first one is a pair of power-saving features, Doze and App Standby that extend battery life by restricting apps behavior when the device is not charging. The second one is the introduction of a new permissions system: Runtime Permissions. This new behavior gives us a more fine-grained control over the permissions by asking them at runtime instead of asking them at install time.
Highlights when targeting API 23:
- Runtime permissions: You must implement a new flow inside your application to ask for permissions in runtime. This includes considering all possibilities like accepting or declining permissions.
- Dropped support for the Apache HTTP client.
- Migration from OpenSSL to the BoringSSL library (avoid linking against non-NDK API libraries such as libssl.so and libcrypt.so).
- Removed
Notification.setLatestEventInfo()
method.
Upgrading targetSdkVersion to 24 — Nougat
An improved Doze mode, background optimizations, multi-window support and notifications redesign came, amongst other things, in this version of Android. Background limitations include network access restrictions and alarms and jobs deferrals.
Highlights when targeting API 24:
- Regarding to background optimizations, the implicit intents
CONNECTIVITY_ACTION
.ACTION_NEW_PICTURE
andACTION_NEW_VIDEO
were removed. - Permission changes: Restricted access to app’s private directory. This means that if you expose a
file://
URIs outside of your app, it will trigger aFileUriExposedException
. - Linking to non-NDK libraries is not allowed anymore.
An update appeared later, Android 7.1 (API Level 25) with a group of new features.
If you target API 25, you may also care about:
- App Shortcuts to take users to your favorite place inside your application.
- Rich content sending through a text editor, via the Commit Content API.
- Added round icon resources:
android:roundIcon
can also be used as launcher icon.
Upgrading targetSdkVersion to 26 — Oreo
With the release of Android Oreo, the Android team have shown us their growing interest in taking care of the battery. One of the biggest changes that we can find is related to background execution limits and background location limits.
Starting in Android 8, apps cannot register broadcasts in their manifests to receive implicit intents. In addition, we shouldn’t call startService()
when the app is in background if we don’t want to face an IllegalStateException
.
Location updates are also affected by background restrictions, this is, our apps will receive less frequent location updates.
But not everything is bad news for developers in this release. New APIs and features are ready to be used, such as Picture-in-Picture mode, notifications enhancements, downloadable fonts, fonts in XML, auto-sizing TextView and much, much more!
If you want to target Android Oreo, you’ll have to keep in mind some points.
Highlights when targeting API 26:
- Background services: Use
startForeground()
andstartForegroundService()
to start foreground services. Remember that trying to start a service viastartService()
In situations it’s not allowed will throw an exception. - Remove any implicit broadcast from your manifest files (except the ones included in this list).
- Location updates: Due to restrictions in location updates in background, FusedLocationProviderClient is recommended when the devices has Google Play Services installed. Geofencing is another option.
- Notification channels: You must assign a channel to all notifications, otherwise they won’t show. A channel is a category that can be, for example, silenced or prioritized individually.
If you have reached this point, then congratulations! Your app is ready to be submitted without worrying about the upcoming restrictions in Google Play.
Remember that this is not a full and complete list of all changes. You should always check the docs to see full changelogs.
Hope it was helpful enough!