1

I need to listen for Install, Updates and Remove broadcasts via a BroadcastReceivers, here is the definition:

<receiver android:name=".InstallReceiver">
    <intent-filter>
        <action android:name="android.intent.action.PACKAGE_ADDED" />
        <action android:name="android.intent.action.PACKAGE_REPLACED" />
        <action android:name="android.intent.action.PACKAGE_REMOVED" />
        <data android:scheme="package"/>
    </intent-filter>
</receiver>

Now, Is it possible to add Intent.FLAG_RECEIVER_FOREGROUND flags to these incoming intents? because in android KitKat receivers affect to foreground services due to bug which reported here.

Any ideas on how to add this flag to incoming broadcasts?

Community
  • 1
  • 1
Ali
  • 2,012
  • 3
  • 25
  • 41

1 Answers1

1

While you are welcome to call addFlags() on the Intent, it will not have any effect. Only the flags added by the broadcaster matter, and you are not the broadcaster.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Oops, can you please check this thread http://stackoverflow.com/questions/23055454/destroy-foreground-notification-when-the-service-get-killed – Ali Sep 09 '14 at 12:57