7heViking
7heViking

Reputation: 7577

onDestroy isn't called on stopSelf() in service

I am starting a service from a broardcast receiver like this:

Intent serviceIntent = new Intent(context, BarometricLogger.class);
context.startService(serviceIntent);

When I have finished doing the Work I am calling my cleanUp() method (it is from the service):

private void cleanUp()
{
    sensorManager.unregisterListener(sensorListener);
    locationManager.removeUpdates(locationListener);
    isLocationSet = false;

    isClean = true;

    this.stopSelf();
}

The problem is that it doesn't look like the service is stopped because onDestroy() isn't called! What am I doing wrong?

BR

Upvotes: 2

Views: 3114

Answers (1)

7heViking
7heViking

Reputation: 7577

ooops... that's almost embarrassing. It didn't stop because I accidentally put it into a never ending loop... :S

Upvotes: 1

Related Questions