- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
PlacePicker 是添加到 com.google.android.gms:play-services-places:9.4.0
中的一个有用的小部件。在这里找到描述:PlacePicker
文档明确指出您需要 ACCESS_FINE_LOCATION 权限才能正常工作。
在 Marshmallow 及更高版本上,您还必须请求用户授予此权限。
但它似乎在不执行任何这些操作的情况下工作!
我的应用程序可以
但在 Marshmallow 设备上运行该应用程序确实会启动 PlacePicker,我可以
谁能证实这一点或解释为什么这个小部件在没有授予适当权限的情况下工作?
最佳答案
这个问题已经有将近一年的历史了,但我试图找到相同的答案,以便它可以帮助其他人。
这是因为 PlacePicker 使用“基于 Intent 的请求”。文档不是很清楚,但它说
1: Only use the permissions necessary for your app to work. Depending on how you are using the permissions, there may be another way to do what you need (system intents, identifiers, backgrounding for phone calls) without relying on access to sensitive information. Source
在这里给出一些线索:
If your requirement for access to user data is infrequent — in other words, it's not unacceptably disruptive for the user to be presented with a runtime dialogue each time you need to access data — you can use an intent based request. Android provides some system intents that applications can use without requiring permissions because the user chooses what, if anything, to share with the app at the time the intent based request is issued. Source
我已经弄明白了如何使用 Marshmallow 和 Lollipop 设备测试权限用例,并将结果与 PlacePicker
进行比较,我认为可以将基于 Intent 的权限与 MediaStore
进行比较根据文档使用这种权限:
For example, an intent action type of 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 the permission). In this case, the system intent will ask for the user’s permission on your behalf every time an image is captured. For example, an intent action type of 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 the permission). In this case, the system intent will ask for the user’s permission on your behalf every time an image is captured. Source
关于android - 为什么 Android PlacePicker 不(!)需要 ACCESS_FINE_LOCATION 权限才能工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38805056/
我正在使用权限 ACCESS_FINE_LOCATION 但是当运行时出现错误:需要 ACCESS_FINE_LOCATION 权限为什么? 提前致谢。 最佳答案 ACCESS_FINE_LOCAT
我是 android 开发的新手,现在我很难获取当前用户位置。 list : 主要 Activity : int permissionCheck = ContextCompat.checkSel
下面是我的AndroidManifest.xml... 如您所见,我添加了获取位置信息所需的适当权限。但
我有这个代码 if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != Pack
我有点害羞。但是找不到问题所在。 这是我的 list 。这是我的代码: pub
我只在使用模拟器时遇到了一个奇怪的错误。我发现了一个 9 个月前有相同问题的问题,但根本没有答案... 我正在使用谷歌播放服务位置来获取我的应用程序中的位置,并且我确定我的 list 权限并且一切都在
我在我的应用程序中请求 FINE_LOCATION 时遇到了一些问题。我试图阅读一些关于 ACCESS_FINE_LOCATION 的内容,我知道我应该将它与 ACCESS_COARSE_LOCATI
我在我的应用程序中请求 FINE_LOCATION 时遇到了一些问题。我试图阅读一些关于 ACCESS_FINE_LOCATION 的内容,我知道我应该将它与 ACCESS_COARSE_LOCATI
我正在使用 SDK-23,每次运行应用程序时,我的 SecurityException 都会被抛出,调试器的错误如下所示: java.lang.SecurityException: "gps" loc
我最近收到来自 Google 的通知,要求更新我们声明在应用内使用原生地理定位的方式。 在 Ionic (v1) 中,安装了 cordova-plugin-geolocation 2.3.0 “Geo
我正在更新我的应用程序以使用新的 Android Marshmallow 权限框架,看起来用户在运行时授予 ACCESS_FINE_LOCATION 权限就足以使应用程序正常工作。这就是我所做的: p
我正在尝试在 Android(2.2 和 2.3)中使用 GPS,但在尝试使用 LocationManager 对象时出现以下错误: WARN/System.err(522): java.lang.S
向我的 list 文件添加权限时,以下 xml 有效。 但是,这个 xml 不起作用。 我应该使用哪一个?如果是第一个,为什么不工作?我该如何解决? 另外,我收到了一个与 Android 6.0
有很多类似的问题被问到,但似乎没有一个能解决我的问题。 我已经应用了文档中提到的运行时权限,但仍然收到运行时错误 LocationServices.FusedLocationApi.requestLo
这个问题在这里已经有了答案: Android permission doesn't work even if I have declared it (12 个答案) 关闭2 年前。 我在另一个应用程
我想从 NETWORK_PROVIDER 获取准确位置,同时关闭 GPS 以节省电量。这似乎是不可能的,因为 android,当指定 ACCESS_FINE_LOCATION 时,即使没有向 GPS_
我目前正在尝试获取用户当前位置的纬度和经度。我在 list 中启用了以下权限。 TargetSDK和min sdk都是23
我有一个 GPS 应用程序已经在 list 中请求 ACCESS_FINE_LOCATION 权限,现在我想添加一个需要 ACCESS_COARSE_LOCATION 的库 (MoPub)。 我是否正
我设置了beacon后台扫描using this tutorial在 BaseApplication 类中,但在 Marshmallow 运行设备中,它显示此日志: Caught a RuntimeE
我的应用正在尝试访问设备的位置,并且我在 AndroidManifest.xml 中包含了以下内容: 我已经按如下方式实现了 Google
我是一名优秀的程序员,十分优秀!