在我的Android应用程序,我需要得到用户的当前GPS位置只有当位置已经从previous位置改变应用程序的开始。但问题是,当我在应用程序中,如果位置的变化(即的若用户是在使用应用程序移动)应用程序是从头开始。
我需要获取用户当前的位置后,停止位置监听器。 removeUpdates方法并没有为我工作。
请帮我在这个问题上。 在此先感谢!
解决方案 mLocManager.removeUpdates(locationListenerObject);
mLocManager = NULL;
你的 onLocationChange
方法中调用此经纬度时长已被抓获的听众。
希望我帮..
In my android app I need to get current GPS location of the user at the start of the application only if location has change from the previous location. But the problem is when I inside the application if location change (ie If user was traveling while using the app) app is starting from the beginning.
I need to stop location listener after getting user current location. removeUpdates method didn't work for me.
Please help me on this issue. thanks in advance !
解决方案mLocManager.removeUpdates(locationListenerObject);
mLocManager = null;
Call this inside your onLocationChange
Method when lat and long has been captured by the listener.
Hope I helped..