Stop Location Listener in Android

前端 未结 5 592
小鲜肉
小鲜肉 2020-12-10 00:50

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 w

5条回答
  •  一向
    一向 (楼主)
    2020-12-10 01:22

    mLocManager.removeUpdates(locationListenerObject);
    mLocManager = null;
    

    Call this inside your onLocationChange Method when lat and long has been captured by the listener.

    Hope I helped..

提交回复
热议问题