I have an application that is both a broadcast sender and a receiver of the standard action android.intent.action.SET_WALLPAPER. I want to do some things only when another application broadcast this intention.
Is it possible to determine who initiated the broadcast in the onReceive method for BroadcastReceiver?
No.
If you only want to do something when the action was transferred by another application (i.e. not yours), I believe that it should be easy for you to determine that your application did not send this broadcast, and therefore it was someone else .
, , , , . :
broadcastIntent.putExtra('com.android.app.EXTRA_APP_CREATED', true)
, ,
if (intent.getExtra('com.android.app.EXTRA_APP_CREATED', false) { ... }
, .