I am using this piece of code to launch my app from a link.
<activity
android:name="com.example.myApp.myClass"
android:label="@string/app_name" >
<intent-filter>
<data
android:host="customHostName"
android:scheme="customScheme" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
This is href link, i want to get the key in the end.
customScheme://customHost/49FYTJTF00
It is working fine on all previous versions of android, but is not working on Lollipop.
When I click the link it only shows the list of browsers to launch.
What should I do?
Instead of using a link to customScheme://customHost/49FYTJTF00, have you tried using a link like
Chrome should be able to open that in your app just fine. At the same time, this might not work on all browsers.
Edit:
After testing and testing, I found that if your scheme contains an uppercase character the browser won't be able to launch it. Your scheme should only contain lowercase characters!
Also note that bug 459156 of the chromium project still doesn't allow you to launch url's directly, you should reference users to a webpage containing this JavaScript code:
Users landing on this page will automatically be prompted with either an Activity chooser dialog or directly send to your Activity.
To try it, open the Android browser go to the url below and copy paste the above snippet in the editor: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro
Gif showing browser + JavaScript opening the Activity
Original post
I tried out your custom URI and it works on Android 5.0
But you should be aware of the following two bugs/issues:
My approach
I created two separate Activities, one as intent receiver and the other as intent launcher. The launching activity has an EditText where the full URI can be entered and a button to launch the entered URI.
Main.java onClick (Launching activity)
manifest.xml (only the activities)
Note the
<data android:pathPattern=".*"/>
part. this part is important so anything after the host will be accepted as valid.UriActivity.java (Receiving activity)
Screenshot:
Test project download:
I made a download for the project if you wan't to try it out yourself.
Keep in mind if you want run the app from Google Chrome you should do that in another way .
Please use pathprefix.
It might solve your problem. Please follow android developer guide URL.
You wrote:
So, use
customScheme://customHostName/49FYTJTF00
instead of
customScheme://customHost/49FYTJTF00