Android - checking GPS status

Hi,

I have a problem in my app when a user does not have a GPS turned on. Because the location is being turned on on the main screen, the app crashes immediately. Is there any way to check if the user has the GPS on their device? I thought about declares, but I have no clue about this topic.

Wrap the crash in a Try…End Try to find the error message:

Try
…turn GPS on…
Catch Error
Var ErrorMessage As String = Error.ErrorMessage
Break
End Try

I don’t see any internal exceptions when starting an app that uses MobileLocation when Location is turned off on the device. Perhaps there is an exception in your code you can catch, like David suggests.

If you are able, create an Issue with a project (and note the relevant device settings) for us to try.

Thanks for your answers. I’ve tried to use the try-catch, but there is no exception.
However, I still need information on whether the location is turned off as some app features cannot function without that and the app doesn’t behaves properly.

Have you implemented the App.UnhandledException event?

Doh. Maybe that doesn’t exist on Android.

It exists. I have a Sentry implemented so each unhandled exception should appear in my issues. Unfortunately, it doesn’t catch the exception, so I’ll try to create an issue with my project.
Thanks for your help :slight_smile:

have u used the RequestUsageAuthorization or maybe just .Start?