应用程序请求位置访问时出现的弹出窗口

问题描述 投票:0回答:3

我的应用程序的位置权限弹出窗口是这样的:

My app's location permission popup is like this

我需要这样的(在网上找到的):

I need it like this (found on net)

我正在 flutter 中完成我的项目,所以我需要做哪些修改才能像第二张图片中那样弹出。

所以我希望能够解决我的问题

flutter android-permissions
3个回答
0
投票

第一个屏幕截图(来自您的)中显示的弹出窗口是 Android 位置权限弹出窗口。请参阅 Android 开发者页面中的本节

第二张截图中显示的弹出窗口是iOS位置权限弹出窗口。请参阅此页的“授予应用程序使用您的位置的权限”部分。

您无法在 Android 上获得第二个弹出窗口。


0
投票

您无法在 Android 位置权限弹出窗口中添加自定义消息,但您可以在 iOS 中添加,您还可以在 iOS 上看到您添加自定义消息的屏幕截图。 对于 iOS,您可以在

iOS/Runner/info.plist
中添加这些行,并且可以更改消息:

<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location in the background.</string>    
<key>NSLocationAlwaysUsageDescription</key>
<string>This app needs access to location when in the background.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs access to location when open and in the background.</string

对于 Android,您可以做的是添加自定义对话框来向您显示消息,然后您可以打开默认弹出窗口。


0
投票

这是不可能做到的。看看下面的文章,它完美地解释了这背后的原因。

看看这篇文章

© www.soinside.com 2019 - 2024. All rights reserved.