android - Flutter background_location 不会在后台更新位置
问题描述
我已经安装了包“background_location”,并在我的屏幕(不是主屏幕)中调用了 initState 方法:
BackgroundLocation.setAndroidConfiguration(10000);
BackgroundLocation.startLocationService();
BackgroundLocation.getLocationUpdates((location) {
updatePosition(location.latitude, location.longitude);
});
只要应用程序在前台,它就可以正常工作。一旦应用程序进入后台,大约 20 秒后,它会停止发送设备的位置,尽管已授予对位置的访问权限:“总是”。
我忘记了任何设置吗?
解决方案
推荐阅读
- django - 在 Hy 中运行 Django
- sql - 更改 oracle XE 11g 的端口时出错
- tensorflow - tf.nn.max_pool() 和 tf.layers.max_pooling2d() 有什么区别
- ssl - https 在 Xampp 上不起作用
- apache-spark - SparkHadoopWriter 在 UserProvider 出现 NPE 失败
- android - 如何显示名称
- java - hashset和hashmap的多重关系
- java - 解析 ASN1 编码的整数
- reactjs - 这种方法是否是避免 .map 的正确方法不是 ReactJS 中的函数
- javascript - 反应无状态子组件不会更新父组件中的状态更改