Android Question autostart app user has turned off

Startup

Active Member
Licensed User
Longtime User
Is there a way to program an app to auto-startup at a preset time that user has turned off other than with bootup?
 

KMatle

Expert
Licensed User
Longtime User
What do you mean with "autostart"? The App's UI or a service? What do you need to achieve?

UI: Not recommended as it is a "bad behaviour" when an app "just starts" out of the blue and disturbs your current activity

Service: Start the service as a foreground service and use a timer to process whatever you need. Backgroundservices won't work anymore/properly on newer devices.
 
Upvote 0

Startup

Active Member
Licensed User
Longtime User
What do you mean with "autostart"? The App's UI or a service? What do you need to achieve?

UI: Not recommended as it is a "bad behaviour" when an app "just starts" out of the blue and disturbs your current activity

Service: Start the service as a foreground service and use a timer to process whatever you need. Backgroundservices won't work anymore/properly on newer devices.

by Autostart I mean APP starts at pre-set time without user starting it after user has closed it. IE: 1. The app is running then 2. user closes it then 3.App starts at pre-set time without user having started it with the device having been kept on (not been shut down or rebooted by user) during all this time.
 
Upvote 0

Startup

Active Member
Licensed User
Longtime User
So you want to restart an app that a user has explicitly closed. You are better off using a service with Automatic Foreground Mode. here you go, look at this tutorial from Erel https://www.b4x.com/android/forum/threads/automatic-foreground-mode.90546/

Actually what I really want to do is have the app, not close when it has been closed by the user pressing the "home" key and then pressing "close all". This is an app that should run and stay running whenever the device is on. Is it possible to have the app stay running when the "close all" is pressed (and only close when the app is individually and explicitly closed by the user?)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This is an app that should run and stay running whenever the device is on.
Use a foregound service (do not use the Stater for this) which start at boot.
 
Upvote 0

Startup

Active Member
Licensed User
Longtime User
By using a foreground service can I prevent the app from closing when "home key" is pressed followed by pressing "close all"?
 
Upvote 0
Top