I was looking at this thread:
Which has this code to autostart the app:
Two "helper function" are provided to create the file that will auto-start or not auto-start your app:
How are these two "helper function" files deployed?
B4X:
https://www.b4x.com/android/forum/threads/auto-starting-your-app.37723/
B4X:
#Region Service Attributes
#StartAtBoot: True
#End Region
Sub Process_Globals
'--- These global variables will be declared once when the application starts.
'--- These variables can be accessed from all modules.
Private tmrStart As Timer
End Sub
Sub Service_Create
'--- set timer to start app after 1 seconds
'--- this gives time for system to init other stuff
tmrStart.Initialize("tmrStart",1000)
End Sub
Sub Service_Start (StartingIntent As Intent)
'--- enabled timer
tmrStart.Enabled = True
End Sub
Private Sub Service_Destroy
End Sub
Sub tmrStart_Tick
tmrStart.Enabled = False
'--- if we find the file 'autoStart.dat' in the folder 'File.DirInternal'
'--- then auto start the app.
Dim checkFile As String = "autoStart.dat"
If File.Exists(File.DirInternal,checkFile) Then
Log("Auto Start is enabled")
StartActivity(Main)
Else
Log("Auto Start is disabled")
End If
End Sub
B4X:
Sub SetAutoStartAppOn(turnON As Boolean)
Dim checkFile As String = "autoStart.dat"
If turnON Then
If Not (File.Exists(File.DirInternal,checkFile)) Then
File.WriteString(File.DirInternal,checkFile,"on")
End If
Else
If File.Exists(File.DirInternal,checkFile) Then
File.Delete(File.DirInternal,checkFile)
End If
End If
End Sub
Public Sub GetAutoStartAppOn() As Boolean
Dim checkFile As String = "autoStart.dat"
If File.Exists(File.DirInternal,checkFile) Then
Return True
Else
Return False
End If
End Sub