The first time my app loads it starts my main activity, and inside my main activity i automatically start a service:
Intent s = new Intent(this, Soc.class);
startService(s);
//start the service for the first time
I need to make sure that when the user is opening the app NEXT TIME, it kills the old service, and recreate the service:
@Override
//this code is on every activity in my application
protected void onRestart()
{
super.onRestart();
Intent s = new Intent(this, Soc.class);
stopService(s);
//kill the service
startService(s);
//start a brand new service
}
Is this the correct way of killing a service and renewing the service?