I am trying to create an URL scheme for my Android application but when i enter the link in the browser it opens the link not the app. So far my code looks like this. The link is formed like this http://myhost.com .
<activity android:name=".activities.OpenSchemeActivity"
android:label="#string/activity_open_scheme"
android:screenOrientation="portrait"
android:exported="true"
android:launchMode="singleTask">
<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="myhost.com"/>
</intent-filter>
</activity>
Does anyone have any idea why is not working?
Sorry to say that it will NOT work directly from the browser's address bar. No way. Only further server redirects or link clicks can lead you to an app picker. As far as I know, browser doesn't handle URL schemes being typed into address bar as something that could require an Intent call.
Related
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.
I've placed a deep link in my manifest using (I think) the format from the documentation
<activity
android:name="my.package.name.AInviteFriends"
android:label="#string/title_activity_a_invite_friends"
android:launchMode="singleTask"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter android:label="#string/filter_view_invite_friends">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="my.package.name" /custom scheme I was told to use
android:host="companyurl.com"
android:pathPrefix="/invite_friends"
/>
</intent-filter>
</activity>
I then navigate to this URL from within the app, hoping for it to be intercepted and go to the activity. I'm not sure why we're using deep links instead of a normal intent, I think it's for tracking or something:
my.package.name://company.com/invite_friends
But when I try this, the browser opens with a Webpage not available/ERR_UNKNOWN_URL_SCHEME error. What am I missing about this intent?
I am not sure you can use an 'address-like' scheme.
I would start with a simple scheme, e.g 'mygreatapp' (the URI is mygreatapp://) and no host or pathPrefix.
See how it works for you and go from there
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.
I have implemented the Android Custom URl scheme and it works fine when I send the link that I want to open as a mail and then click on it.
It does not work when I type the same address in the address bar of my Mobile Browser which in turn gives a page not found error.
This is my intent-filter for the same -
<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="myappname.com"/>
</intent-filter>
Is there something else that I need to specify for making http://myappname.com open if I type it in a web browser. Is it the case that some phones/browsers do not support such behavior? Or is this not possible at all?
Any help will be appreciated.
Thank You in advance.