GPS图标locationManager.removeUpdates后(),并通过设置locationManager为null仍在闪烁 [英] GPS icon is still blinking after locationManager.removeUpdates() and by setting locationManager to null

查看:499
本文介绍了GPS图标locationManager.removeUpdates后(),并通过设置locationManager为null仍在闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的定位跟踪应用程序。但我停止做两件事情让位置更新...

I am developing the Location Tracking application. But i am stopping getting the location update by doing 2 things...

  1. locationManager.removeUpdates(本);和
  2. 设置locationManager参考空。

这将停止获取位置坐标,因为我想...

This will stop getting location co-ordinates as i want...

但问题是GPS图标仍然闪烁..这将耗尽设备的电池。

But the problem is the gps icon is still blinking.. which will draining the device's battery.

所以,请帮我停止该GPS定位......

So please help me in stopping this GPS fixes...

推荐答案

如果你显示你的位置和/或在您的图形页面指南针,你必须禁用它们。如果你不这样做,GPS仍然有效。

If you display your position and/or the compass in your mapView, you have to disable them. If you don't do that, GPS is still active.

例如:

private MapView mapView;
private MyLocationOverlay Location;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.frame_layout);

    mapView = (MapView) this.findViewById(R.id.mapView);
    Location = new MyLocationOverlay(this, mapView);
    Location.enableMyLocation();
    Location.enableCompass();
    mapView.getOverlays().add(Location);
}

@Override
public void onDestroy() {
    Location.disableMyLocation();
    Location.disableCompass();
}

这篇关于GPS图标locationManager.removeUpdates后(),并通过设置locationManager为null仍在闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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