As i was doing some experimentation with android, i tried to launch a native app from a browser link... and i was successful... i would like to share whatever i have done with you..
The first thing one has to do to launch an app from a browser’s link is to add an additional intent filter in the app’s Manifest file... for example to launch my native app (called UnitConverter) i have added the following few lines in the App’s manifest...
and in the web app i have added html code as
and it has worked fine..
However, sometimes we may need to pass some query parameters in the html query tag like
To catch these query parameters inside the Android app, i have written the following piece of code and added it in the onCreate function of the main Activity just after the line super.onCreate(savedInstanceState).
And voila!!! it has worked perfectly...
Hope this discussion comes handy for the Android learners...
and in the web app i have added html code as
and it has worked fine..
However, sometimes we may need to pass some query parameters in the html query tag like
To catch these query parameters inside the Android app, i have written the following piece of code and added it in the onCreate function of the main Activity just after the line super.onCreate(savedInstanceState).
And voila!!! it has worked perfectly...
Hope this discussion comes handy for the Android learners...
3 comments:
Hi Som.
I like you article, but have a problem with the link.
I need to send a link by email that will open my app.
So, I've done something like this
public void onClick(View v) {
final Intent emailIntent = new Intent(
android.content.Intent.ACTION_SEND); emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, "");
Uri myUri = Uri.parse("myapp://");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html
.fromHtml("Check out this great application: Link"));
and in the manifest
and as you wrote in the method but the link doesn't work...
Could you help me, please?
Viktoriia... see the following link...
i think you will get the answer from user1053327's post...
please try it and if it helps let me know...
http://stackoverflow.com/questions/3469908/make-a-link-in-the-android-browser-start-up-my-app
Hi Som,
I have attempted to implement your method but have not been able to get the link to work my native app's manifest is reproduced below will you advise me on the updates required to allow my HTML5 cross platform app to launch this. I have added the additional items to the manifest as suggested without any success and would appreciate any assistance.
Regards,
Joe
Post a Comment