Skip to content Skip to sidebar Skip to footer

Foreground Service Being Killed On Notification Click

In Android 4.4.2 clicking on my Foreground Service notification is killing my process. On older devices (Samsuing Tab 2 running 4.2.2), I can swipe away the Activity from Recent Ta

Solution 1:

Add FLAG_RECEIVER_FOREGROUND flag to the PendingIntent used from your notification in order to allow the Service to run at Foreground priority.

Intent newIntent = newIntent(context, BroadcastToOrderedBroadcast.class);
newIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
return PendingIntent.getBroadcast(NativeService.getInstance(), mNotificationID, newIntent, PendingIntent.FLAG_UPDATE_CURRENT);

Here is the source of this information : Android Issue Tracker tool.

Post a Comment for "Foreground Service Being Killed On Notification Click"