Hi,
I am using MyLocation as a basis for my project.
I want to stop and kill the service when the user stops the program.
This is what I tried:
In tracker.bas:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
In Main:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Pls help.
			
			I am using MyLocation as a basis for my project.
I want to stop and kill the service when the user stops the program.
This is what I tried:
In tracker.bas:
			
				B4X:
			
		
		
		Sub Service_Destroy
    ' Service.StopAutomaticForeground 
    CancelScheduledService(Me)
    StopService (Me)
    Service.StopForeground(1)
    ToastMessageShow("Close Service", True  )
    Log ("Stopservice")
    lock.ReleasePartialLock
End Sub
	In Main:
			
				B4X:
			
		
		
		Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed Then 
       StopService (Tracker)
        Log ("Tracker stopped")
    End If
End Sub
	Pls help.