Mobile Web wake-up app

Source: Internet
Author: User

1, in the system system comes with the browser

First make the HTML page, the page content format is as follows:

    

The meanings of each item are as follows:

Scheme: Identify the app that starts. ※ The following details are described

Host: Proper description

Path: The key※ required to pass the value is not also available

Query: Get the value of key and Value※ no also can

Example: <a href= "konger://jp.app/openwith?roomid=17" > Point I jump Empty ears </a>

Next comes the Android side.

First, add the following to the main activity of Androidmanifest.xml. (given when activating activity)

* Items must be added

<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= "Konger" android:host= "Jp.app" android:pathprefix= "/openwith"/> </ Intent-filter>

The contents of the HTML description are added to <data .../>.

The required content is only scheme, and no other content app can be launched.

※ Note: The contents of Intent-filter "Android.intent.action.MAIN" and "Android.intent.category.LAUNCHER" are 2, and cannot be mixed with this additional content.

So, if you join the same activity, do this as follows, or it will cause the app icon to disappear on the desktop. 
<intent-filter>      <action android:name= "Android.intent.action.MAIN"/>      <category android: Name= "Android.intent.category.LAUNCHER"/>  </intent-filter>  <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= "Konger" android:host= "Jp.app" android:pathprefix= "/openwith"/>  </ Intent-filter>

In that case, no problem.

Next, add the following code where the activity needs to be valued, and I'll write it directly in the OnCreate function:

Intent I_getvalue = Getintent ();  String action = I_getvalue.getaction ();    if (Intent.ACTION_VIEW.equals (ACTION)) {      uri uri = I_getvalue.getdata ();      if (uri! = null) {          String name = Uri.getqueryparameter ("name");          String age= uri.getqueryparameter ("Age");      }  }

This will get the value passed to the URL.

2. In a third-party browser

Host an HTTP service in a local application, the local service address is 127.0.0.1:8765, and the host is used to monitor the service data and open itself.

3. Open in

After registering your app on an open platform, you can get AppID and jump to your app with this AppID.
The iOS platform format is as follows: Appid://openwebview/?ret=0,appid to replace the actual, back can take parameters, in your app can receive.
Example: Location.href = wx234ad233ae222://openwebview/?ret=0

Implemented in the iOS system  1, in the system comes with the browser

  

Frequent use of the Safari browser to browse the Web click the URL will wake up the site's mobile app

Need to be set up in the app's project

1. Open the Myapp-info.plist file in the project

2. Open a new URL types in the file

3, in the project to achieve the following methods

-(BOOL) Application: (UIApplication *) application Handleopenurl: (nsurl *) URL {    if (URL) {        Uialertview * Alertview = [[Uialertview alloc] Initwithtitle:nil message:@ "You wake up your app" delegate:selfcancelbuttontitle:@ "OK" Otherbuttontitles:nil, nil];        [Alertview show];    }    return YES; }

4, enter konger://in Safari browser, you can launch the application.

2, in their own browser display banner, there is a display open, no prompt to download

<meta name= "apple-itunes-app" content= "app-id=432274380" >

3. In a third-party browser

Host an HTTP service in a local application, the local service address is 127.0.0.1:8765, and the host is used to monitor the service data and open itself.

4. Open in

After registering your app on an open platform, you can get AppID and jump to your app with this AppID.
The iOS platform format is as follows: Appid://openwebview/?ret=0,appid to replace the actual, back can take parameters, in your app can receive.
Example: Location.href = wx234ad233ae222://openwebview/?ret=0

  

  

Mobile Web wake-up app

Related Article

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.