Android Question How can I start my App via Intent?

Steini1980

Active Member
Licensed User
Longtime User
Hi,
I need some help: I've developed an Application, now I'm trying to add some Application Interop, to start my App from another via Intent, see the following Code-Snippets:

Code in Application Manifest:
B4X:
AddReceiverText(Service,
<intent-filter>
    <action android:name="de.dms.dwviewer.SEARCH" />
</intent-filter>)

Code in Service Module:
B4X:
Sub Service_Start (StartingIntent As Intent)
  If StartingIntent.Action = "de.dms.dwviewer.SEARCH" Then
    If StartingIntent.HasExtra("PARAM") Then
      CallSubDelayed2(Main,"SetParameterAndSearch",StartingIntent.GetExtra("PARAM"))
    End If 
  End If
End Sub

Call from external Application:
B4X:
Dim myIntent As Intent
myIntent.Initialize("de.dms.dwviewer.SEARCH","")
myIntent.PutExtra("PARAM","A140145")
StartActivity(myIntent)

Now I get the following Error Message:
android.content.ActivityNotFoundException: No Activity found to handle Intent

What's wrong with my Code?
 

Steini1980

Active Member
Licensed User
Longtime User
Thank you Erel,
I'm not sure if I understand you correctly. Does I have to Add a Activity Module instead of the Service Module?
Does I have to Add the Method "Sub Activity_Start(StartingIntent As Intent)" to the Activity or how can I read the Parameters?

Maybe you can show me an Example, I think I have some fundamentally problems understanding what is to do, to add an Intents to own Applications.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…