Pending Broadcastreceiver Does Not Start Using Setdeleteintnet
I make a notification and what i want to do is, when the user clicks the notification I sent to clear it, i want a pending broadcast to be executed. there is a method called 'setDe
Solution 1:
You have pretty much answered your own question. This can't work with LocalBroadcastManager
!
When you register a receiver with using LocalBroadcastManager
, it only listens for broadcast Intent
s that are broadcast by your application. In your case, the broadcast Intent
is sent by Android's notification framework, which is not part of your application. In this case, your registered receiver will not get triggered.
You need to register your receiver for global broadcasts. You can do this either by creating an instance of your receiver and calling registerReceiver()
on the application Context
OR you can just add your receiver to the manifest with a <receiver>
tag and make sure that you set android:exported="true"
Post a Comment for "Pending Broadcastreceiver Does Not Start Using Setdeleteintnet"