消息:“无法启动前台服务:用户拒绝前台权限”\uuuu proto\uuuuu:object

e4eetjau  于 2021-09-08  发布在  Java
关注(0)|答案(0)|浏览(269)

我正在使用插件https://github.com/seididieci/capacitor-backround-geolocation 用于我的应用程序背景位置跟踪。下面是插件中的方法 goForeGround() 当应用程序在后台时,它应该可以工作,但它不工作,这给了我这个错误

message: "Cannot start a foreground Service: user denied FOREGROUND permissions." __proto__: Object

这是我的密码

BackgroundGeolocation.initialize({
  notificationText: "Your app is running, tap to open.",
  notificationTitle: "App Running",
  updateInterval:10000,
  requestedAccuracy: BgGeolocationAccuracy.HIGH_ACCURACY,
  // Small icon has to be in 'drawable' resources of your app
  // if you does not provide one (or it is not found) a fallback icon will be used.
  smallIcon: "ic_small_icon",
  // Start getting location updates right away. You can set this to false or not set at all (se below).
  startImmediately: true,
});
BackgroundGeolocation.goForeground()

在我的 AndroidManifest 我也提到过这一点

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

在手机上,位置也被选择为 Allow Always 但我仍然收到了这个错误,原因是什么

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题