Pregunta

I use this code:

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(
    LocationManager.GPS_PROVIDER, 
    MINIMUM_TIME_BETWEEN_UPDATES, 
    MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,
    new MyLocationListener()
);

locationManager.addNmeaListener(new NmeaListener() {
     @Override
     public void onNmeaReceived(long arg0, String arg1) {
        if(arg1.startsWith("$GPRMC")){
            retrieveLocationButton.setText(arg1);
        }
     }
});

It works, but I want to get gprmc statement every two minutes.

¿Fue útil?

Solución

I have been working on an open source gps tracker project for several years. I recently updated it to handle periodic updates from android, ios, windows phone and java me cell phones. It is fully functional and does what you need and is MIT licensed.

https://github.com/nickfox/GpsTracker

If you go to the android project under phoneClients, you will find a full working application that does periodic updates (you can change the interval from one minute to two minutes easily) and uses the new google play location services.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top