Try using the following code. It's a dirty workaround but it works (unless 
the process is killed via ps or DDMS - Does anyone have some sort of 
solution for that ???).

public void onTaskRemoved(Intent rootIntent)
{
Intent restartServiceIntent = new Intent(getApplicationContext(), 
this.getClass());
restartServiceIntent.setPackage(getPackageName());

PendingIntent restartServicePendingIntent = 
PendingIntent.getService(getApplicationContext(), 1, restartServiceIntent, 
PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmService = (AlarmManager) 
getApplicationContext().getSystemService(Context.ALARM_SERVICE);
alarmService.setExact(
AlarmManager.ELAPSED_REALTIME,
SystemClock.elapsedRealtime() + 1000,
restartServicePendingIntent);

super.onTaskRemoved(rootIntent);
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to