【问题标题】:Opening Location Permission from the inside of App flutter从 App Flutter 内部打开位置权限
【发布时间】:2021-01-25 11:49:21
【问题描述】:

我想从应用程序内部访问的页面:

【问题讨论】:

  • 试试this插件。
  • 为此使用 permission_handler,pub.dev/packages/permission_handler
  • 我已经在使用这个包,但它并没有把我带到这个页面,它通常会打开应用程序设置。 @fartem
  • @DharaPatel permission_handler 包也没有完成所需的工作

标签: flutter dart flutter-plugin


【解决方案1】:

使用Geolocator Package,您可以打开如下位置设置。请注意,这只会打开设备Location页面,而不是应用权限管理器。

Geolocator.openLocationSettings();

【讨论】:

  • 我需要在位置选项卡上专门打开应用权限管理器
  • 除非你建立自己的频道来打开特定的 Android Intent
【解决方案2】:

使用这个名为 permission_handler 的包。这将允许您打开应用设置页面,您可以在其中找到位置权限。

用法:

RaisedButton(
            onPressed: () =>  openAppSettings(),
            child: Text("Open app settings"),
          ),

【讨论】:

    【解决方案3】:

    GeoLocation包中使用Geolocator.openAppSettings();

    这样

    AlertDialog(
                actions: [
                  CupertinoDialogAction(
                    child: Text('Back'),
                    onPressed: () {
                      if (Platform.isIOS) {
                        exit(0);
                      } else {
                        SystemNavigator.pop();
                      }
                    },
                  ),
                  CupertinoDialogAction(
                    child: Text('Settings'),
                    onPressed: () {
                      Geolocator.openAppSettings();
                    },
                  ),
                ],
              ),
    

    【讨论】:

      猜你喜欢
      • 2020-04-06
      • 2017-12-05
      • 1970-01-01
      • 1970-01-01
      • 2020-08-24
      • 1970-01-01
      • 2019-02-18
      • 2020-08-17
      • 2020-02-28
      相关资源
      最近更新 更多