颤音位置返回速度准确性为-1
我正在使用ios真实设备(iPhonexs-也许是iOS 13)在调试模式下定期测量速度,并在室内运行。
这是我的代码。
class _TimerScreenState extends State<TimerScreen> {
Timer? timer;
int restMilliSec = 0;
int setCnt = 0;
@override
void initState() {
super.initState();
bool canVibrate;
restMilliSec = decideTimerTime(currentType) * 1000;
timer = Timer.periodic(Duration(milliseconds: 1), (timer) async {
// ... other code for another logic... //
if (canVibrate) Vibrate.vibrate();
setLocation();
}
});
}
void setLocation() async {
Location location = Location();
LocationData _currentPosition = await location.getLocation();
print("accuracy : ${_currentPosition.accuracy}, speed: ${_currentPosition.speed}");
print("Speed Accuracy : ${_currentPosition.speedAccuracy}");
}
}
我不知道-1的含义是什么。 如何获得速度的正数? 其他值打印得很好。
I'm using Flutter and location package for measuring speed periodically in my iOS real device(iPhoneXS - maybe iOS 13) in debug mode and also running indoors.
This is my code.
class _TimerScreenState extends State<TimerScreen> {
Timer? timer;
int restMilliSec = 0;
int setCnt = 0;
@override
void initState() {
super.initState();
bool canVibrate;
restMilliSec = decideTimerTime(currentType) * 1000;
timer = Timer.periodic(Duration(milliseconds: 1), (timer) async {
// ... other code for another logic... //
if (canVibrate) Vibrate.vibrate();
setLocation();
}
});
}
void setLocation() async {
Location location = Location();
LocationData _currentPosition = await location.getLocation();
print("accuracy : ${_currentPosition.accuracy}, speed: ${_currentPosition.speed}");
print("Speed Accuracy : ${_currentPosition.speedAccuracy}");
}
}
I don't know what's the meaning of -1.
How can I get positive number for speed?
Other values are printed well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iOS上的
coreLocation
的文档(在其上flutter 位置软件包是建立的)指定-1的含义for a>:和
speedaccuracy
:因此,随着您的推论,负值表示无效或不可用的速度。 为什么在没有更多信息的情况下,很难说您的速度像无效一样回来。
The documentation for
CoreLocation
on iOS (upon which the Flutter location package is built) specifies the meaning of -1 forspeed
:and
speedAccuracy
:Thus, as you've deduced, negative values indicate an invalid or unavailable speed. Why your speed as coming back as invalid is difficult to say without more information.