0
我觀察者的用戶的,像這樣如何正確調用navigator.geolocation的stopObserving()?
_someFunc() {
navigator.geolocation.watchPosition((position) => {
...
)};
}
_someFunc()
的位置被稱爲在_onPress()
。在另一個onPress()
我想停止watchPosition
。這樣做,我使用stopObserving
像(很糟糕?)記錄here。 在另一onPress()
我只需撥打
_anotherSomeFunc() {
navigator.geolocation.stopObserving();
}
然而,這給了我警告:
叫stopObserving沒有現有的訂閱。
我不知道該怎麼做。什麼樣的訂閱?