Android Question Start at Boot (optional)

Harris

Expert
Licensed User
Longtime User
How to make Start at Boot optional?

My app requires GPS service module to run (which in turn will fire the Main module if not paused).
My GPS mod will drain your battery in 15 minutes (since it is so aggressive - and needs to be - AND not plugged in to a charger).
This is a brute force to ensure MY app is running and fore front - on any device it is installed.

HOWEVER, in different invocations of the same app, I would like the user to set weather this app should start at boot. How? (start at boot = 'userbootsetting' - kvs store setting).

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Additionally make sure not to set #StartAtBoot to true on the starter service. Use another Service for this.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
I see the dilema here. The app needs to start at boot to see if it "should" start up.... If yes, continue - otherwise shut it down before it goes too far.
I small service could handle this - or get the user to install a task manager (tasker and such) that will start this / and or any other app at boot based on the device owners preference.

The starter service would start this special service (where #StartAtBoot: True) and execute ExitApplication if user had set it not to start at boot?

Thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The starter service would start this special service (where #StartAtBoot: True) and execute ExitApplication if user had set it not to start at boot?
No. The starter service is not relevant here.

You need to add a service and set StartAtBoot to true. If the service is not needed then call StopService(Me). Don't call ExitApplication.
 
Upvote 0

PSEAD

Member
Licensed User
Longtime User
If a service is set to StartAtBoot, will the starter service still run? i.e. will the Process_Globals in the starter service be initialised?
 
Upvote 0
Top