iOS Question Background Location Tracking : How to stop

tufanv

Expert
Licensed User
Longtime User
Hello

I am using background location tracking. What I want to do is , to stop the backgorund tracking after some time if speed is less than 10. When I use locationchanged event to track the speed in the background, I saw that when there is no location change , the event not firing ( normally) so i cant measure the time correctly. IS there an easy way to stop the backgorund tracking if there is no movement for example for 5 minutes ?

( As I understand , using allowpauselocationautomaticly make prolems so there must be a way to do that )

edit: I also tried to use allowpause but the location tracking is not pausing even after 30 minutes altough i set the activity type to = 2 which is automativenavigation.

I changed the code to allowpuase like this :

B4X:
Dim no As NativeObject = locmanager
    no = no.GetField("manager")
    no.SetField("pausesLocationUpdatesAutomatically", True)
    AllowPauseLocationAutomatically(locmanager,2)
    StartBackground(locmanager, 0) 'replaces locManager.Start
   
    locmanager.StartHeading

TY
 
Last edited:

tufanv

Expert
Licensed User
Longtime User
Edit: After further tests , I realized that
AllowPauseLocationAutomatically works. If no location change for 20 minutes it stops background tracking.
 
Upvote 0
Top