Here is an exemple of the link:
https://somelink.someotherlink.ws/path1/path2/path3/path4/dynamic_path1/dynamic_path2
<activity
android:name=".activite.Activity"
android:exported="true">
<tools:validation testUrl="https://somelink.someotherlink.ws/path1/path2/path3/path4/..*/..*/"/>
<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="https"
android:host="somelink.someotherlink.ws"
android:pathPattern="/path1/path2/path3/path4/..*/..*/" />
</intent-filter>
</activity>
So here when I run the test from the android studio tool the url is resolving my activity and also launching it.
This also is working when clicking this url link from other apps
But only when it comes to web browser (Entering the link in the search bar and click enter or any other programatic redirection) the redirection not going to my app.
Ex:
https://somelink.someotherlink.ws/path1/path2/path3/path4/dynamic_path1/dynamic_path2
this is not getting resolved in anyway
I've also tried to use the two dot enforcement and single dot enforcement but getting same result.
Thanks for any help.
Related
What I want to achieve is that if user tap on the link e.g. on Whatsapp:
HTTP://dev.mycompany.com/qr/asd89f7as98df78
This link will open my app supplied with the deep link.
But the issue is this link actually open my app inside the Whatsapp. So when I open the app switcher, it looks like there are two instances of my app opened. How can I fix this?
I suspect this has something to do with the way I configure my intent filter on Android Manifest. But I'm inexperienced with intent-filter. This is the current configuration for my intent filter(s):
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:autoVerify="true">
<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="dev.mycompany.com" />
<data android:scheme="https" />
</intent-filter>
Is there anything I can do to fix the problem? The first intent filter is the default when I create the app. The second one is from copy pasting from solutions I find on stack overflow. But I don't think this is the fully correct solution. I don't want the app to can be opened as popup.
I seem to be doing something wrong with deep linking in my app. I have two activities: a post viewer which views posts on a site, and a profile viewer which views a users profile. Below is my code that I've set up following Google's guide to deep linking.
Profile Activity Manifest Declaration
<activity
android:name=".ui.activity.ProfileActivity"
android:parentActivityName=".ui.activity.MainActivity">
<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:host="gab.ai"
android:pathPattern="/..*"
android:scheme="https" />
</intent-filter>
</activity>
Post Viewer Activity Manifest Declaration
<activity
android:name=".ui.activity.PostViewerActivity"
android:parentActivityName=".ui.activity.MainActivity">
<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:host="gab.ai"
android:pathPattern="/..*/posts/..*"
android:scheme="https" />
</intent-filter>
</activity>
I've left out the intent handling code because it is redundant. The deep links work properly, except for a weird issue when opening URLs that direct to the post viewer activity.
This works perfectly. Tapping a link such as https://url/.. opens the dialog and lists only one option When selecting the app, it opens the proper activity perfectly.
Here's where it gets weird. When clicking a URL such as https://url/../posts/.. the Android System sees both activity deep links as feasible. My question is how do I get around this? Changing the URL scheme is out, and I'm not fluent enough about deep links to figure out a workaround.
In ProfileActivity android:pathPattern="/..*" equals to /..*/posts/..* because an asterisk ('*') matches a sequence of 0 to many occurrences of the immediately preceding character. Try to use escape character \ as explained in docs
There is a perfect way to launch our android application through Deeplink.
<activity
android:name="com.example.android.GizmosActivity"
android:label="#string/title_gizmos" >
<intent-filter android:label="#string/filter_title_viewgizmos">
<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="www.example.com"
android:pathPrefix="/gizmos" />
</intent-filter>
</activity>
Here, I can easily launch my application through “http://www.example.com/gizmos”, But my question comes when I am going to hit shorten URL of this link i.e. goo.gl/tNQpWe.
What could be the ways to launch my app through tiny/ shorten url too ?
Please suggest.
The short url will be redirecting to your server/domain and from there you do the same what "gizmos" did. Deep linking is basically a HTML page rendering some expected data by your android application (In your case android:host and android:pathPrefix)
You will need to create a basic html rendering the android schema if you need data to be passed. I would suggest you to follow Branch.io.
https://blog.branch.io/technical-guide-to-deep-linking-on-android-chrome-intents
I am trying to open my app from a website and read some text from link. The URL will be like codespike.com/?code=xxxx. I need to read the xxx but my problem is that I am not able to open my app when this specific URL in being opened in the browser. For testing I also used a webiste bfinstafollowers.com, not working with this either.
This is what I am trying.
<activity
android:name="com.softech.betforinstafollowers.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="bfinstafollowers.com" android:scheme="http"
android:pathPrefix=".*"/>
</intent-filter>
</activity>
also tried with <category android:name="android.intent.category.BROWSABLE"/> and without android:pathPrefix=".*" but my app doesnt open.
Solved my issue, as it turns out regular http, https doesn't work. I had to create my custom scheme for this purposes.
The following works fine:
I click on the link www.mycompany.com in an email and it starts my app:
<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:host="www.mycompany.com/download" android:scheme="http"/>
</intent-filter>
However, what I want to work is as below but it's not working:
I want to be able to restrict it to the link www.mycompany.com/download:
<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:host="www.mycompany.com/download" android:scheme="http" />
</intent-filter>
Why the distinction? I don't want to block my entire website with the app. I just want that specific domain to redirect to the app. How do I do that?
What you've shown is not a subdomain. That is,
www.mycompany.com/download
is not a subdomain of
www.mycompany.com
But you could use a subdomain to address this issue by setting up something like
download.mycompany.com
and have it map to www.mycompany.com/download. (Most servers allow you to set up subdomains like that.) You can then modify the intent filter accordingly.
EDIT
To support what you're trying to do without setting up a subdomain, you can do the following:
<data
android:host="www.mycompany.com"
android:scheme="http"
android:pathPrefix="download"
/>
I would suggest you to try latest feature made available by Google and that is App-indexing to show your app even when user search about your website on Google.
You need to go through 2 steps:
1 Sign Up for this feature here
2 Update your app as well as sitemap of your website as mentioned here
For further reference you can go through this documentation
Screenshot :