怎样的android停止GPS [英] android how to stop gps

查看:262
本文介绍了怎样的android停止GPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在通过以下code启动监听器工作正常。

After launching listener by the following code is working fine.

LocationManager locationManager =(LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(
                    LocationManager.GPS_PROVIDER, WLConstants.DELAY_HOUR, gpsl
                            .getMinDistance(), gpsl);

在一段时间我停止监听由以下code

After some time i stop the listener by the following code

locationManager.removeUpdates(this);

但问题是,它仍然在寻找我的GPS的任何解决方案???如何阻止全球定位系统?

but problem is it still searching my gps any solution ??? how to stop gps ?

推荐答案

您需要通过执行所请求的位置更新到locationManager.removeUpdates LocationListener的()方法相同的对象。

You need to pass the same object implementing LocationListener that you requested location updates for to the locationManager.removeUpdates() method.

所以,除非 gpsl 是同一个,你应该叫:

So in unless this and gpsl are one and the same, you should call:

locationManager.removeUpdates(gpsl);

这篇关于怎样的android停止GPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆