Android Question Intent Issue

techknight

Well-Known Member
Licensed User
Longtime User
Hey, I have a different developer who isnt familiar with B4A, and codes natively with the android environment.

So to get our two apps to speak together, we have chosen to use Intents assuming they will work as intended.

His program is a background service.

Mine is a foreground activity.

But for some reason, I cant get intents to work. it keeps crashing with ActivityNotFoundException.

His background service manefest has this:
<receiver android:name="com.majordisplay.jashanno.broadcastreceivertest.PacketReceiver">
<intent-filter>
<action android:name="com.majordisplay.jashanno.packetbroadcast"/>
</intent-filter>
</receiver>

My intent code is this:

B4X:
Sub cmdSendIntent_Click()
    Dim Intent1 As Intent
    Intent1.Initialize("com.majordisplay.jashanno.broadcastreceivertest.PacketReceiver", "")
    Intent1.SetComponent("com.majordisplay.jashanno.packetbroadcast")
    Intent1.PutExtra("value", txtPacket.Text)
    StartActivity(Intent1)
    ToastMessageShow("Intent Sent", True)
  
End Sub

Any ideas?
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello,
Excuse me, I am not an expert but if I remember correctly, sometimes ago I read something like StartService(theIntent) instead of StartActivity in such cases
Could you try ?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You can get the broadcat sent by the other app with the broadcastreciever library.

To send a message to the app you should be able to send an intent to the app directly.
You can try to use the packagemanager to get the starting-intent for the app...

Additional refer to the thread @lemonisdead provided in post #4
 
Upvote 0

haddad

Member
Licensed User
Longtime User
hello ,

i want to send data ( login an password ) from activity A to activity B with intent how can i do ?

thinks
 
Upvote 0
Top