I'm new in android programming.So please help me.. I'm developing an app in which it continuously monitors the current location.I want he app to run in background even if the user goes for an other app.He will be able to stop the location updates whenhe returns to my app.Everything is working fine until i do an outgoing call.I'm not able to remove location updates after the outgoing call..
Below is my code..
tb_trackstartstop.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
if(isChecked)
{
trackflag=true;
tracklistener(HomeActivity.this);
}
else
{
if(trackflag)
trackmlocManager.removeUpdates(trackmlocListener);
trackflag=false;
Toast.makeText(HomeActivity.this, "Stopped", Toast.LENGTH_LONG).show();
}
}
and my code for onpause and onresume is as follows
@Override
protected void onPause()
{
super.onPause();
bundle.putBoolean("trackflagState", trackflag);
}
@Override
protected void onResume()
{
super.onResume();
trackflag=bundle.getBoolean("trackflagState",false);
}