Turn on GPS on Android device

Turn on GPS on Android device

  

Hi,

I have tried to use Diagnostic Plugin in order to check if GPS is on and if not direct user to GPS settings screen. Unfortunately the Diagnostic Plugin does not work with version Version 10.0.604.0 - I am not able to generate the Android app after referencing my app with the Diagnostic Plugin. There is an error:


Error: Error installing Cordova plugin: cordova.plugins.diagnostic.


Do you have any solution to that? The ideal functionality would be to turn on the GPS automatically without a need for a user to do it himself. But I am not sure if that is feasible.

Regards,

Michal

"Do you have any solution to that? The ideal functionality would be to turn on the GPS automatically without a need for a user to do it himself. But I am not sure if that is feasible."


I don't really think this is possible.... perhaps if the device is rooted?

How about redirecting user to GPS Settings screen? The Diagnostic Plugin was supposed to be doing this but it does not work.

Claring,

Golden rule: if you're not sure what you're talking about, you better not talk about it. Why would you need a routed device for turning on GPS?

That said, it seems Michal has two problems:

  1. The Diagnostics Plugin doesn't seem to work, and;
  2. If the GPS is off, he needs to turn it on.

As for the first one, I don't see a reason why it wouldn't work with 604, so I'd advise to ask for help in the component's forum.

As for the second one, I feel the need to invoke my golden rule above unfortunately.

Kilian Hekhuis wrote:

Claring,

Golden rule: if you're not sure what you're talking about, you better not talk about it. Why would you need a routed device for turning on GPS?

That said, it seems Michal has two problems:

  1. The Diagnostics Plugin doesn't seem to work, and;
  2. If the GPS is off, he needs to turn it on.

As for the first one, I don't see a reason why it wouldn't work with 604, so I'd advise to ask for help in the component's forum.

As for the second one, I feel the need to invoke my golden rule above unfortunately.


Hey Killian, I was talking about enabling GPS without requiring user interaction, which is what Michal refered to as the ideal solution. From my previous experiences in mobile development I found that rooting usually helps to bypass security checks set by the system. 

However if the goal is to create an app for a general public instead of a few clients within a company this wouldn't be considered a valid option.


On topic though, I did see other people having problems with cordova plugins lately, perhaps the cause is something much deeper than just a problem with this specific component?