Why doesn't Android PlacePicker (!) Require ACCESS_FINE_LOCATION permission?

PlacePicker is a useful widget added to com.google.android.gms:play-services-places:9.4.0 . Find a description here: PlacePicker

The documentation clearly states that you need ACCESS_FINE_LOCATION permission for this.

In Marshmallow and above, you should also ask the user to grant this permission.
But it looks like it works without it!
My application does

  • provide map API key
  • not determine resolution in AndroidManifest
  • do not ask the user to give this permission at any time

But running the application on a Marshmallow device launches PlacePicker, and I can

  • choose the right place (impossible without an API key).
  • go to the "My location" section using the MyLocation button (possibly without an API key)

Can someone confirm this or explain why this widget works without proper permissions?

+5
source share
1 answer

The question is almost a year old, but I tried to find the same answer so that it would help someone else.

This is because PlacePicker works with an โ€œintent-based queryโ€. The documentation is not very clear, but it says

1: Use only permissions necessary for your application to work. Depending on how you use permissions, there may be another way to do what you need (system intentions, identifiers, background settings for phone calls) without relying on access to confidential information. A source

And give some tips here:

If your requirement for access to user data is infrequent - in other words, it is not unacceptably destructive for the user to be presented with a run-time dialog every time you need to access the data - you can use the request based on intent. Android provides some system intentions that applications can use without requiring permissions, because the user chooses anything to share with the application when issuing the request based on the intent. A source

I found out that use cases for testing permissions were allowed using Marshmallow and Lollipop devices, comparing the result with PlacePicker , which I thought could use intent-based permissions using MediaStore , which use this permission according to the documentation:

For example, the intent action type MediaStore.ACTION_IMAGE_CAPTURE or MediaStore.ACTION_VIDEO_CAPTURE can be used to capture images or videos without directly using the Camera object (or requiring permission). In this case, the intent of the system will request permission from the user on your behalf each time the image is captured. For example, the action action type MediaStore.ACTION_IMAGE_CAPTURE or MediaStore.ACTION_VIDEO_CAPTURE can be used to capture images or videos without directly using the Camera object (or requiring permission). In this case, the intent of the system will request permission from the user on your behalf each time the image is captured. A source

+1
source

All Articles