I wrote an entry in the old TJC forum.
The gist is that there are 4 ways an app can start on its own on android.
Autostart when android starts
This is controlled with the Sailfish settings app.
click Settings app → switch to Apps tab → select the app → use the " Allow application background service to start on bootup " checkbox (Needs to be off to prevent autostart).
This will prevent the app from autostarting whenever Android App Support is started.
Notifications
Apps can automatically start to show an alert pop-up (if you set some alarm clock thingy inside your app, e.g., a game reminding you that your crops are now ready to harvest or whatever). You need to access the Android settings to change that (either you can use the “Open Android Settings” button in the App’s settings, or there’s a patch called “Launcher icon for android settings” in the Patchmanager Webcatalog)
Either:
click Settings app → switch to Apps tab → select the app → click the “Open Android Settings” button
then from the App’s Android settings → click Notifications
in the notifications setting, tweak to your wishes.
Or:
click Android Settings app → select App & notifications → select Notifications → scroll to the section titled Recently sent
tweak to your wishes
This will prevent applications from autostarting a showing toaster alerts about in-game events, google maps showing alerts about traffic in your area, etc.
Google Cloud Messaging (push notifications)
Whenever an app receives a push notification from the network, the app can start to fetch that network message and act up on it. (e.g.: somebody writes you a chat message, so the Google’s cloud pings your phone to tell that there’s a chat message waiting for you, WhatsApp auto-starts, retreives the chat message and displays it) (or: your bank wants you to click on their 2FA app to confirm an transaction, so Cloud pings your phone, the 2FA app starts and you get the “Please confirm” pop-up). The purpose is to avoid every single app on your phone wasting battery by constantly probing their server for updates, instead everything is centralized through the push notification system.
This can only be controlled if you use microG, as far as I know the proprietary Google Play Service don’t let you configure that.
click microG settings app → select Cloud Messaging → select the app.
You can tweak 2 settings:
-
Start app on push message: You can then select if the app is allowed to autostart to process alerts from the internet when they arrive, or if the alerts will wait until you manually start the app.
-
Allow registration: If the app is even allowed to receive alerts from the internet.
If this function isn’t turn on (your didn’t even install microG), chat apps might not immediatly get chat message but only periodicaly when they directly contact their server, sometime only when you bring the app into focus.
(Usually I allow WhatsApp and the banking app, and kill everything else).
Share suggestions
Whenever you hit a Share button in an Android app, in addition to showing you a list of apps which can share that media type (e.g.: all chat apps can share JPEG photos) like when you click Share on SailfishOS, on Android some apps can auto start and generate a list of suggested share (e.g.: WhatsApp will suggest your top most frequently used contacts).
AliExpress’ shop absolutely loves this function and constantly autostarts whenever you hit an android share button.
I have not found a way to disable this, except either using the SailfishOS share option (doesn’t trigger autostart) or manually kill autostarted application (e.g.: in Crest)
TODO: move this to a Wiki or add to the one @flypig created with the microG howto.