Android Question StartAtBoot or User Start

marcelo_efn

Member
Licensed User
Longtime User
Hi,
I created an App that has # StartBoot = True in Service Module. How to tell if it has been initialized
By boot or user clicking the app icon? It's possible to know?

Service Module

#Region Service Attributes
#StartAtBoot: True
#End Region
Sub Process_Globals
End Sub
Sub Service_Create
End Sub

Sub Service_Start (StartingIntent As Intent)
Select Case StartingIntent.Action
Case "android.intent.action.BOOT_COMPLETED"
Commands...
Case <Initialized by User>????
Commands....
Case Else
Commands....
End Select
End Sub
 

marcelo_efn

Member
Licensed User
Longtime User
Thanks for your comment, androh. But there is a specific task for when the user initializes the App by clicking on the icon. "Case else" will also be executed every time the sub Service_Start is called internally and not only when the App is initialized by the user. Any idea or suggestion?

See my routine in Service Module:

#Region Service Attributes
#StartAtBoot: True
#End Region
Sub Process_Globals
Dim Notification1 As Notification
End Sub
Sub Service_Create
Notification1.Initialize
Notification1.Icon = "icon"
Notification1.Vibrate = True
Notification1.Sound = True
End Sub

Sub Service_Start (StartingIntent As Intent)
Select Case StartingIntent.Action
Case "android.intent.action.BOOT_COMPLETED"
SendMsg
StartServiceAt("",DateTime.Now+(30000),True)

Case <Initialized by User>????
<Not send msg>

Case Else
SendMsg
StartServiceAt("",DateTime.Now+(60000),True)
End Select
End Sub

Sub SendMsg
Notification1.OnGoingEvent = False
Notification1.SetInfo("Mensage for User", DateTime.Now, Main)
Notification1.AutoCancel = True
Notification1.Notify(1)
End Sub
 
Upvote 0
Top