How do I move to another screen if GPS is disabled?

I am using built in location sensor for a purpose of moving users to screen(no gps) if his location services are off.
But I can't achieve it, can you please suggest if this is possible ?

This may work:

Also, are you switching screens only for notifying the user that their location sensor is off? If that is the case, you could do that with a Notifier instead, like this:

1 Like

Thanks a lot @NishyanthKumar for your answers and block pictures, but in my case user has already gave the location permission.
Now if he open the app and if his gps is off then I want to notify him to open gps first.

Thanks

You might be able to use the information to determine if a device's Location Services are active or not by polling these LocationSensor Properties:

Enabled If true , the LocationSensor will attempt to read location information from GPS, WiFi location, or other means available on the device. This setting does not control whether location information is actually available. Device location must be enabled or disabled in the device settings.

AvailableProviders List of available service providers, such as gps or network. This information is provided as a list and in text form.

ProviderName The current service provider. The provider will most likely be either GPS or network.

ProviderLocked The device will not change the service provider. It is possible for a device to switch service providers when the current provider is unable to provide adequate location information. ProviderLocked is a Boolean value: true/false. Set to true to prevent providers from changing. Set to false to allow for automatic switching when necessary.

See the full discussion in the LocationSensor documentation.

Be aware it is impossible to turn on or turn off Location using Blocks. Setting Location Services must be done using the Settings on your device. See Gps enabled / disabled, but does it work?

What you do depends on why you need to change Screen if the GPS hardware is disabled. What have you tried? You might try this example Problema initializar latitud y longitud gps al momento de inicializar pantalla

If you can use extensions in your app then you can use my extension which includes a method that checks if localization is enabled.

1 Like

you have to check, if gps is included in the AvailableProviders property list
just use the is in list block for that...

Taifun


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

1 Like