質問

I recently used the fused location provider to locate the user during special tasks inside our app. Till now I could not find out a way to check a few settings:

  • When the user allowed Google Apps to access the location(Google Settings), does this affect Google Play Services as well.
  • If the users allowed apps to use the GPS (Standard Location Settings) to determine the location, are Google Play Services also allowed to access the GPS.

The documentation on fused location provider does not say anything about that. Would be happy for any suggestions. Thanks!

役に立ちましたか?

解決

According to Google Support Pages this resritiction only applies to Google apps and not to services(i.e Fused Location Provider). Therefore you should not worry about this setting. Just check which Providers are enabled and it should be fine.

Important: This setting only controls Google apps; if you turn this setting off, Google services that aren't apps and non-Google apps may receive your location from the device.

他のヒント

There are three relevant settings here:

1) The "Google Apps" setting you mention: This setting will not affect your app.

2) The gps setting you mention: This setting WILL affect your app (the fused location provider can't use gps when its off).

3) The network location setting: This setting WILL affect your app (the fused location provider can't use network location when its off).

This behavior remains unchanged from the old Location-manager APIs.

This question still comes up for some searches. Lots have changed since it was originally asked. Now there is the availability of the SettingsApi which makes life a lot easier. It allows you to check if the location services are available on the device and there is a complete example provided by google on github that shows how to use this API. The sample code will prompt the user to enable location if it's switched off.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top