使用java代码停止GPS监听windev mobile

时间:2017-01-05 09:34:52

标签: java android gps windev

我使用Windev mobile和以下java程序初始化GPS:

public static void initGps()
{
    Context myContext     = getContexteApplication();
    LocationManager mylocationManager = (LocationManager) myContext.getSystemService(Context.LOCATION_SERVICE); 

    LocationListener mylocationListener = new LocationListener() {

    public void onLocationChanged(Location location) {
        }
    public void onStatusChanged(String provider, int status, Bundle extras)     {

        }

        public void onProviderEnabled(String provider) {
        }

        public void onProviderDisabled(String provider) {
        }
    };

    // Define a listener that responds to GPS STATUS
    GpsStatus.Listener mygpsStatusListener = new GpsStatus.Listener() {

        public void onGpsStatusChanged(int event){
        }
    };

    // Register the listener with the Location Manager to receive location updates
    mylocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mylocationListener);
    mylocationManager.addGpsStatusListener(mygpsStatusListener);
}

如何关闭GPS数据采集而不关闭应用程序以节省电池?

谢谢你 弗朗索瓦

0 个答案:

没有答案