Android launches app in browser

Source: Internet
Author: User



The way to start the app in the browser is as follows:


Add information about Intent-filter to the activity that needs to jump:


<intent-filter>
<data android:scheme= "Com.example.scheme"/>
</intent-filter>


The actual proportions are as follows:
<activity android:name= ". Browactivity ">
<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= "Com.example.scheme"/>
</intent-filter>
</activity>



Then add HTML to the following links, for example: <a href= "My.special.scheme://other/parameters/here" >


After entering the app, you can use Getintent () to get information about the URL carrying:


eg:http://twitter.com/status/1234
Uri data = Getintent (). GetData ();
String scheme = Data.getscheme (); "http"
String host = Data.gethost (); "Twitter.com"
list<string> params = data.getpathsegments ();
String first = params.get (0); "Status"
String second = Params.get (1); "1234"

Android launches app in browser

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.