Android Question FusedLocation Intervals

fbritop

Active Member
Licensed User
Longtime User
I was working with FusedLocation, not sure why, but it worked before.

I set the interval to 1000ms, but if I check the LocationChange event, it only triggers every 10 seconds, it was working ok before, not sure if it was after upgrading to API 30.

B4X:
    Dim lr As LocationRequest
    lr.Initialize
    lr.SetInterval(1000)
    lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
    lr.SetSmallestDisplacement(1)
    lr.SetFastestInterval(1000)

Is there a restriction by the current OS on android that limits the interval?, I´m using a Xiaomi device.

Thanks
 

fbritop

Active Member
Licensed User
Longtime User
Same results... I can check in the logs the intervals the LocationChange is being called:

1628877334542.png

test change:
 
Upvote 0

fbritop

Active Member
Licensed User
Longtime User
Now strange. If I use FusedLocationProvider in B4X main page code, then it updates every one second. It seems odd that when it is called from a class wont update that frequently. These are times when LocationChange has been called and from where

B4X:
B4X MainPage:18:34:29
*** mainpage: FLocation_LocationChanged [mainpage]
NHFused Location:18:34:29
B4X MainPage:18:34:30
B4X MainPage:18:34:31
B4X MainPage:18:34:32
B4X MainPage:18:34:33
B4X MainPage:18:34:34
B4X MainPage:18:34:35
*** mainpage: FLocation_LocationChanged [mainpage]
NHFused Location:18:34:35
B4X MainPage:18:34:36
B4X MainPage:18:34:37
B4X MainPage:18:34:38
B4X MainPage:18:34:39
B4X MainPage:18:34:40
B4X MainPage:18:34:41
*** mainpage: FLocation_LocationChanged [mainpage]
NHFused Location:18:34:41
B4X MainPage:18:34:42
B4X MainPage:18:34:43
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Now strange. If I use FusedLocationProvider in B4X main page code, then it updates every one second. It seems odd that when it is called from a class wont update that frequently. These are times when LocationChange has been called and from where
It doesn't matter where it is initialized.
 
Upvote 0

fbritop

Active Member
Licensed User
Longtime User
Sory my fault at all :( . I had modified the Lib once with an upgrade that I posted on the owner.Somehow the modified lib was OK, but I did reinstall B4I, so the library went to other directory.I noticed that after changing the version number of the lib and notice that it was not getting changed in the Libs tab.


and what happens if you use FusedLocationProvider in a service?
 
Upvote 0
Top