Service At Boot

madSac

Active Member
Licensed User
Longtime User
I have made a service that is started in boot. I did it using manifest.
But there are some essential things which can be done only using activity.So for that i want to know the method to determine that whether the service has been started by bootmanager or something like that or using my application ?

I should tell you that i am using StartServiceAt with 5min interval to keep service alive so may be that can interrupt if i use variables.
 

madSac

Active Member
Licensed User
Longtime User
i have used in service
B4X:
Sub Process_Globals
   Dim actVisible As Boolean
End Sub
Sub Service_Start (StartingIntent As Intent)
   Select StartingIntent.Action
      Case "android.intent.action.BOOT_COMPLETED"
         actVisible=True
         StartActivity(Main)
   End Select
   
End Sub

in activity i have used
B4X:
Sub Activity_Create(FirstTime As Boolean)
'some code

If(client.actVisible==True)Then ExitApplication

'some other code
end sub

is it fine ?
 
Last edited:
Upvote 0
Top