I have been trying to develop Location listener using NMEANListener in android.
I have a main activity which has start button. Clicking on start button initializes the locationManager and NMEAListener. After this I get notifications in
public void onNmeaReceived(long arg0, String arg1)
However after some time my NMEAListener is removed by android.
My Mainactivity.java class has following instances declared
private LocationManager locManager = null;
private TextView output = null;
private NMEAMessageListener nmeaMessageListener = null;
I initialize the listener in Main activity class on click of button
nmeaMessageListener = new NMEAMessageListener();
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000,100,nmeaMessageListener);
Location location=locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Please let me know as the reason for Listener being removed by android. Is there a better way of doing it. I want to keep my location listener running for long time. Shall i use intentservice to start NMEANListener.
Any help will be appreciated.