如何使用Flutter在iOS中检查和切换后台应用刷新状态(UIBackgroundRefreshStatus)?

fzsnzjdm  于 2023-05-29  发布在  Flutter
关注(0)|答案(1)|浏览(246)

使用Flutter检查UIBackgroundRefreshStatus ON/OFF的方法
我正在寻找一个解决方案来切换后台应用程序刷新状态(UIBackgroundRefreshStatus)在iOS中.
此外,我想找到后台应用程序referesh设置(请检查下面的截图)开/关使用Flutter。Screenshots

gopyfrb3

gopyfrb31#

你可以使用url启动器包和使用下面提到的代码。

void openSettings() async {
  String url = '';

  if (Platform.isIOS) {
    url = 'App-Prefs:root=General&path=Background_App_Refresh';
  }

  if (await canLaunch(url)) {
    await launch(url);
  } else {
    throw 'Could not launch $url';
  }
}

调用openSettings()方法在你想调用的地方,希望这样做是对你的工作,

相关问题