Android Question Intent Sender?

Alessandro71

Well-Known Member
Licensed User
Longtime User
is there a way, in a Receiver module, to know which app (by package name) has sent the Intent?

B4X:
Sub Process_Globals
    
End Sub

'Called when an intent is received.
'Do not assume that anything else, including the starter service, has run before this method.
Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent)
    Log($"Received $Time{DateTime.Now}"$)

    If StartingIntent.IsInitialized Then
        'who called me?
    End If
End Sub
 
Solution
So I guess that those are you other apps that send the intent. In that case you should add a field to the intent with the app package name.

Alessandro71

Well-Known Member
Licensed User
Longtime User
So I guess that those are you other apps that send the intent. In that case you should add a field to the intent with the app package name.
I guess I'll have to...
Even though I have a use case where I'd like to know if my was started by the user using the system launcher, or by another app (not mine) with StartActivity
 
Upvote 0
Top