Android Question intent an app from html and send parameter

youjunjer

Member
Licensed User
Longtime User
Dear All
I need intent an app form web html, and this is solved below.

But now, I need send some string data to this app when intents. Such as sending a web link to this app. I have read some threads but i can't find solution.
May some one can tell me both send and receive method or function.


HTML:---------------------------------------------
B4X:
<a href="intent://you package name#Intent;scheme=http;package=you package name;end;">link</a>

App's:Manifest file--------------------------------------
B4X:
<intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="http" android:host="you package name" />
</intent-filter>
 
Last edited:

youjunjer

Member
Licensed User
Longtime User
Thx, Erel,
I try to read that thread. But I never learn about java. May you post a simple example about how to receive the string in b4a for me.
Really thanks for your reply.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

youjunjer

Member
Licensed User
Longtime User
Thx Erel,

if html look like this, the passing string name "S.myextra" and content "mystring"
B4X:
<a href="intent://your package name#Intent;scheme=http;package=your package name;S.myextra=mystring;end;">link</a>

The string str1 will get the value "mystring" show below.
B4X:
Sub Activity_Resume
   If Activity.GetStartingIntent.IsInitialized Then
      Dim str1 As String = Activity.GetStartingIntent.GetExtra("myextra")
      '..........the thing you need to do
   End If
  
End Sub
 
Upvote 0
Top