LocationSensor problems (with Xiaomi phone)

I’m working on an App which uses the GPS. It’s working on my phone, a Samsung.
Today I tested it on a Xiaomi and it was not working.
So, in the same moment, I tested Maps and it was working properly.
I don’t understand why.
Any tips?

what exactly means "not working"?
what happens and what do you want to happen intead?
are you testing outside of a building to get a good GPS signal?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Thank you
The App was made to move a marker, and the center of the map, to the LocationSensor’s coordinates.
What happens instead is that the marker doesn’t move from Lat,Lon=0,0. It is like the gps is disabled, but it is not, or some permission has not been granted, or like i am in a buiding, but i’m not.
What is strange is that Google Maps works (the marker moves to the current location).

The instructions i use are simple: on location change i set the marker coords, but after the accuracy is >=1 or not HasAccuracy

Tomorrow I try again without the IF condition… maybe the HasAccuracy has a problem?

Tomorrow, after you show some meaningful code and you try doing whatever you are trying to do, I might be able to provide specific advice.

The rational way to test if the LocationChanged event has triggered after a satellite fix is to use code similar to what is shown in How to put my location on a map.

Using the method you tried

obviously, does not work to achieve your goal. Try the example code instead. You shouldn’t be trying to establish whether the LocationSensor.Accuracy is true or not within the LocationChanged event. What does not true or false mean? That’s what your Blocks are being asked to do.

You might be using the LocationSensor in conjunction with the Map component. You didn’t make it clear. If you are using both the Map component AND the LocationSensor; do you tell the Map component to use the LocationSensor information as shown with Blocks? If you do not ask the M to communicate with the LS, the app uses the default capabilities of the Map component to try to refresh once ever 60 seconds instead of using the refresh rate of the LS. If the TimeInterval is set to less than about 30 seconds on most phones, the phone attempts to refresh before achieving a satellite fix. What TimeInterval did you use?


Waiting for you to tell us what happens without your IF statement Carlo and whether you tried the example code.


Dear all
i removed the IF and i tested again but without success. So it’s not related to that IF.
(The meaning and my intention of the IF was:
center the Map on the Lat and Lon of the LocationSensor only
IF the Accuracy is >=1 or if the phone has no accuracy feature)

I didn’t report my test yet, because I was waiting to test also what was the content of LocationSensor.Latitude and Longitude (but my daughter’s Xiaomi was not available today :smiley: , i should do it tomorrow)

The TimeInterval I use is 1second.

Let me say it again: on a Samsung Phone (and also on a Samsung Tablet) the App is working as expected. Till now the problem is only on the Xiaomi. Google Maps works fine on Xiaomi.
What’s more, consider that if I use a “Fake GPS App” for my tests, the App works also on Xiaomi.

Another strangeness (that i should probably report on another ticket but just because the 2 issues could be related, let me tell you here) is that on this Xiaomi also the ext that should keep the display always On, TaifunTools.KeepScreenOn, doesn’t work…

I made my tests, LocationSensor.Lat and Lon were giving always 0,0.
But the problem of Gps has now been solved, you know how?, what a shame!, simply by “resetting the phone”…
Strange behaviors, isn’t it?
The problem of KeepScreenOn still remains, I will open a new ticket for it.
Thanks (and sorry i should say).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.