9

I'm using startForeground to run a service in my app. Does this impact Play Store auto updates when it's running? It seems like it does because I'll release a new version and a test tablet will still be running the old one for days after the release. The app shows "pending update" in Google Play on the device.

As background, this is not a normal consumer app and does need to run all the time to sync data. Without the foreground service I found even persistent alarms would stop running in a timely fashion after a few days, so as far as I'm aware, startForeground is the only way to keep the app running permanently.

Thanks for reading!

Greg Taylor
  • 113
  • 6
  • 1
    Did you find out how foreground services interact with play store auto updates? Does the update never occur? – tmm1 Aug 25 '18 at 01:30
  • That seems to be the case. I never figured out if there's a way around it, or how apps like Gmail are both super responsive and update properly. I guess you could use a foreground service and force a shutdown periodically to see if that gets it to update while shut down, but that wasn't an option for us. – Greg Taylor Aug 27 '18 at 15:16

1 Answers1

-1

You can create an application which the Android system puts under whitelist application.

Under certain circumstances, a background app is placed on a temporary whitelist for several minutes. While an app is on the whitelist, it can launch services without limitation, and its background services are permitted to run.

An app is placed on the whitelist when it handles a task that's visible to the user, such as:

  • Handling a high-priority Firebase Cloud Messaging (FCM) message.
  • Receiving a broadcast, such as an SMS/MMS message.
  • Executing a PendingIntent from a notification.
  • Starting a VpnService before the VPN app promotes itself to the foreground.

So you can create a high-priority FCM message for your update and send it as an update notification or just a blank message.

Set Up a Firebase Cloud Messaging Client App on Android

Anmol Bhardwaj
  • 636
  • 6
  • 18