Android Question How to close aplication properly

Arturs

Member
Licensed User
Longtime User
In my aplication I have service module and three activities.

In service module I detect whether bluetooth module is on.
If user or another aplication turns off BT (when my aplication is running on). My aplication should be closed as well.

I wonder what should be closed at the beginning.
service module or aplication.


It is my code to detect if BT was turned off


B4X:
Sub admin_StateChanged (NewState As Int, OldState As Int)



If (IsPaused(Main) = False Or IsPaused(Parameters) = False Or IsPaused(calibration)=False) And (NewState = admin.STATE_OFF)  Then

    Common.connected = False
    Log ("BT off")

what should be here ?

End If

End Sub
 

Roycefer

Well-Known Member
Licensed User
Longtime User
If you need a Sub in a Service to run soon after the Service is created, why not just call that sub from within Service_Create?
 
Upvote 0
Top