0

I'm currently building an application for Android Wear where the user can edit some settings only if the GPS on the handheld is enabled. I'm wondering whether I can enable the GPS programatically by asking permission on the Smartwatch, instead of having to redirect the user to the handheld's screen to accept or decline the request.

I created the following mockup to illustrate the flow that I want to accomplish:

Flow I want to accomplish

I have the following questions, I have also added a 1* and 2* to the image to illustrate where my question applies:

1*: Is it possible to check whether the handheld GPS is enabled on the Smartwatch? If not, do I have to construct a custom request to the handheld, check availability on the handheld and return true or false to the smartwatch myself?

2*: Is this possible, or do I really have to redirect the user to his or her handheld device to turn on the GPS? I couldn't really find any documentation on this, but it would seem that Google would (or should) have thought about this.

Any help is appreciated, thanks in advance.

Teun Kooijman
  • 1,132
  • 2
  • 10
  • 23

1 Answers1

1

I'm going to answer your two questions in reverse order:

2: You can't just turn on GPS without the user agreeing to it - doing so would have security/privacy issues - but you can trigger a system UI to get that permission (and then turn on GPS if given). It's called the SettingsApi , and is well described in this SO post: How to show enable location dialog like Google maps?

1: I'm reasonably sure that you'll need to relay this request to the handheld, and show the API there. I doubt that the system UI exists on Wear. However - given you're going to need to implement this SettingsApi call anyway - you might try doing it on Wear first to see what happens. You can always move the code to the handheld if it fails.

Also, have you thought about the case where the watch has its own internal GPS? Will you still require the use of the handheld's GPS?

Community
  • 1
  • 1
Sterling
  • 6,365
  • 2
  • 32
  • 40
  • Thank you for your answer! I'll have a look at the SettingsApi as per your suggestion, but I fear that prompting the user via that API will just enable the watches GPS instead of the handheld. I am aware of the fact that I could potentially request GPS updates on the watch if it has GPS available, but I fear that it will only make things more complicated. – Teun Kooijman Mar 17 '16 at 20:48
  • Then you're probably stuck with having this stuff run on the linked handheld. Perhaps with some variation on Wear's standard "Open on phone" UI? – Sterling Mar 18 '16 at 04:23