tech: Google Play store updates and Android foreground notifications

In the office we’re working on an Android app which isn’t your usual app: we work with a handset OEM to get it pre-loaded on their handsets in the system partition. At the time it required system permissions and had a foreground notification.

The slow rate of ROM OTA updates from OEMs being what they are, we wanted a faster way to deploy updates to our app, so the obvious choice is to also publish our app into the Play store and let Android’s Play services automatically update it from there. Except for one problem: when we published APK updates to the Play store, the handsets would never automatically download the update and install it. Try as we might to debug that, we couldn’t figure out why our app wasn’t getting updated by Play Services like all the other apps. We even got Google to investigate a bit, but never got a solution. So we ended up building a service into our app that would monitor for an updated version being available (via separate metadata that we uploaded to a server) that would then notify the user of the update being available, and then expecting the user to manually click on that to download the update. Yuck.

Fast forward a while, and we rewrite our app so it no longer needs Android system permissions. And Android provides new APIs so we don’t need to use a foreground notification. It still is signed by the same key. As soon as we publish the 2nd version without the foreground notification to the Play store, we notice that the Play services update is working.

So that leads us to believe that when an Android app has a foreground notification running, Play services won’t update it automatically, because it is still running and Play services doesn’t want to update a running app. I don’t expect many developers are using long-running foreground notifications, but FYI for those that are.

While that foreground notification is present, your app is running, and it looks like Play services won’t upgrade your app while it is running in the foreground.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: