webpage . :
For the Android platform, the URI is mainly divided into three parts: scheme, authority and path. The authority is further divided into host and port.
The format is as follows:
scheme://host:port/path
For example: let's take a
look at the data flag
<data android:host="string" android:mimeType="string" android:path="string" android:pathPattern="string" android:pathPrefix="string" android:port="string" android:scheme="string" />
The following is a test demo to test how to receive external jumps:
The configuration in the manifest file of our App entry Activity is as follows:
<activity android:name=".EntranceActivity" android:launchMode="singleTask" android:screenOrientation="portrait" android:theme="@style/Entrance"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <!--Android Receive External Jump Filter--> <intent-filter> <!-- The protocol part is configured, the same should be configured on the web --> <data android:host="splash" android:scheme="test"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <action android:name="android.intent.action.VIEW"/> </intent-filter> </activity>
As shown above, if scheme and host are set in data, the Activity can receive and process Uri similar to "test://splash".
The webpage needs to be configured as follows:
<!DOCTYPE html> <html> <body> <iframe src="test://splash" style="display:none"></iframe> </body> </html>
SO, when we jump to the app from the web page, if it is installed locally, then we can jump over smoothly. Does it feel so easy?
If you want to handle the external jump Uri separately, add the following code to the Activity that receives the external jump:
Intent intent = getIntent(); String data = intent.getDataString(); if (data.equals("yijj://splash")){ // TODO: Do what you want here. . . startActivity(new Intent(this,EntranceActivity.class)); }else { finish(); }
http://www.open-open.com/lib/view/open1484051365201.html