Cannot Change the Provider of the Location Sensor

The location sensor component’s provider seems always to be GPS, even though I explicitly set the “Location Sensor”.“Provider Name” to “network” (as the “Status Changed” event of the “Location Sensor” was never invoked). While I can do this using similar blocks using App Inventor.

you forgot to provide a screenshot of your relevant blocks…
to be able to change the provider, the property ProviderLocked must be false


Thank you for the reminder. And my blocks are in the following:

I’ve set up a label to show the value of the “Provider Locked” property at the start of the app (by placing the corresponding block in the screen1 initialization event), and it shows “false” every time.

is network available in the property AvailableProviders?
did you enable WiFi?
what happens, if you disable GPS?

For your questions:
Yes, network is available as it is shown in the AvailableProviders list (the one encircled in red).
And WiFi is enabled (the wifi icon is shown on the top right corner).
And on my phone, the whole location service must be enabled or disabled all together, I cannot just disable GPS alone.

And FYI, the one below the AvailableProviders list is the current provider (GPS), and the one below the current provider is the “Provider Locked” property (false).

what happens, if you disable location service?

If location service is disabled:

So that the provider list is now empty.

Also FYI, I’ve tried this on two Android 11 phones, and the results are the same.

see also this thread

you might want to try MIT App Inventor to find out, if this makes a difference


Thanks, Taifun. The thread you recommended to read sheds light on the cause of the problem. After reading the post, I went on to read the documentation of the MIT App Inventor:

So, I set this property to “true” instead. And now I can change the provider to “network”.

And also, obviously, the documentation of Kodular:

is actually incorrect. It is pointing to the opposite direction! Although I understand the name of this property is really confusing. Hopefully the documentation will be corrected soon.

P.S. “StatusChanged” event is still not invoked, even though when the provider is changed.

1 Like

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