Recently written projects involve external browsers as well as Project WebView in the app, so summarize below and share with you.
The general method of implementation is still relatively simple,
1: register in the list
First, in the Androidmanifest file, register a filter
<intent-filter >
<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= "xxx" android:host="xxx"/>
</intent-filter>
Where scheme and host are as follows:
Scheme://host:port/path
Example: nearbar://com.nearbar.android:200/folder/subfolder/etc
\---------/ \---------------------------/ \---/ \--------------------------/
Scheme Host Port Path
\--------------------------------/
Authority
2: Receive in Mainactivity
if (Intent.ACTION_VIEW.equals (ACTION)) {
Uri uri = I_getvalue.getdata ();
String data = uri.tostring ();
}
Because the URL in my project is a JSON string, it is parsed to determine the specific operation.
Android WebView (External browser) to tune up the app