I want to start my Basic4Android application just after booting my tablet to run automatically without user intervention. Can someone give some indication to do it, maybe using a service?
I want to start my Basic4Android application just after booting my tablet to run automatically without user intervention. Can someone give some indication to do it, maybe using a service?
use a service that "start at boot" to open your apk when you restart device!
like this:
B4X:
'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Service_Create
End Sub
Sub Service_Start
StartActivity(main)
StopService("")
End Sub
Sub Service_Destroy
End Sub
I'm not sure that showing an Activity right after boot will result with a good user experience. However as written above you can start services right after boot by checking Project - Service properties - Start at boot.
It works!
The reason for doing this is that the tablet will be dedicated to this application so it is better to go directly to the running application for the user.
Thank you very much for your prompt reply.:sign0098:
On a similar note, is it possible to make the service boot preference adjustable by the user? Or am I better off setting a flag, always starting the service, and killing it immediately if the user doesn't want it to start with the device? This approach seems wasteful, but I can certainly go that route if it's the best option for now.
Or am I better off setting a flag, always starting the service, and killing it immediately if the user doesn't want it to start with the device? This approach seems wasteful, but I can certainly go that route if it's the best option for now.