Android Question Open my app with a link

jvrh_1

Active Member
Licensed User
Hello,
I am trying that when my app is shared using a link (for example, a user send a url to another user by whatsapp), If my app is installed in the recpetor user's device, my app open automatically.
I have checked this thread, but doesn't works.
Any idea?
 

DonManfred

Expert
Licensed User
Longtime User
I have checked this thread, but doesn't works.
1. I don´t see any project uploaded which shows the problem!?
2. I don´t see any error log
3. I don´t see which url you are opening on the Device
Any idea?
How could we help with this less information you provide?
 
Upvote 0

jvrh_1

Active Member
Licensed User
DonManfred thank you for anwser. Sorry, but my english is not good and I believe that I have'nt explained well.

There isn't code because I only want, that when I click a link (sending to me by whatsapp, mail...) in my device, my app open or the android system ask to me that What app do I want to use to open this website?

I write this lines in the manifest, but anything happens:


B4X:
AddActivityText("main",
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT"></category>
    <category android:name="android.intent.category.BROWSABLE"></category>
   <data android:scheme="https://" />
</intent-filter> )
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I believe you need to construct an intent to open the 3rd party app.
You did not understand the problem, @barx

He want to configure is own app to open when someone clicks a specific link in Whatsapp, a website showed in the devices Browser, a email opened in the device email client.

For ex:
barx://myapp/par1

B4X:
AddActivityText(main,
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT"></category>
    <category android:name="android.intent.category.BROWSABLE"></category>
   <data android:scheme="barx" />
   <data android:host="myapp" />
</intent-filter> )

(Untested)
 
Last edited:
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User

I realised that just after posting, oops. Then quickly deleted the post hoping no-one had seen it yet, oops again. Me creating a big mess again. Sorry
 
Upvote 0

jvrh_1

Active Member
Licensed User
Yes, I want that when the user clicks on a link (for example www.myapp.com/xxx), the app open automatically and show some mensaje. This messaje depends of the "xxx" part of the link. The link always have the same structure.
Is this possible? I have read some avout schemes, but I don't know how use it and if it could be the solution.
Thank you.
 
Upvote 0

jvrh_1

Active Member
Licensed User
I have written this one in the manifest editor. Anything happens.

B4X:
AddActivityText("main",
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT"></category>
    <category android:name="android.intent.category.BROWSABLE"></category>
   <data android:scheme="http" />
   <data android:host="mypackagename" />
   </intent-filter> )
 
Upvote 0

jvrh_1

Active Member
Licensed User
?? I don´t understand
When I click over a link that starts with http, open it with the default browser.

I have found it in an other thread. Its yours too. In I think that it could be a solution. But I do not know how modify to my app.


B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
AddActivityText(Main,
<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <!-- Accepts URIs that begin with "beka://service” -->
  <data android:scheme="beka" android:host="service" />
</intent-filter>
<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <!-- Accepts URIs that begin with "beka://kunden” -->
  <data android:scheme="beka" android:host="kunden" />
</intent-filter>
<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <!-- Accepts URIs that begin with "beka://ab” -->
  <data android:scheme="beka" android:host="ab" />
</intent-filter>
)

I only want that when I recived a link (in whatsapp for example) that starts with myapp.com, and the user clic over it. My app starts.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
changing the theme will not help here. Starting with Whatsapp (and other apps and browsers too) do not know other schemes thena http and https.

To get it working you can use a Domain of yours, add a subdomain for it to be used by your app.

Set the manifest to use this subdomain.
B4X:
AddActivityText(main,
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT"></category>
    <category android:name="android.intent.category.BROWSABLE"></category>
   <data android:scheme="http" />
   <data android:host="muhwies.basic4android.de" />
</intent-filter> )

In this case muhwies is a subdomain of my domain basic4android.de.

I do compile my app and start it at least once to let the Android System know that my app is responsible for any http Link starting with http://moviews.basic4android.de

For example i do send a Message to my Android Device using Whatsapp

and then i open the chat in whatsapp containing this url



i now can click on this url. Android will open my app as it is registered to open all links from the domain muhwies.basic4android.de...


 
Upvote 0

jvrh_1

Active Member
Licensed User
Thanks a lot! Perfect! Thank you. Now, my app opens when recived this link.
Now, How can I get the link in my app? It is to say. How did you get data= http://muhwies.basic4android.de/test1/tes2? in your application?
I want that depends of this link, my app will do differents things. Only need this pice of information to continue working.
Thanks again DonManfred.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…