H5处理
<a href="ygmxapp://ygmx.app/openwith?name=zhangsan&age=26">启动APP</a>
Android处理
1.在AndroidManifest.xml的MAIN Activity下追加以下内容(按照下面的格式来追加)
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- 在MAIN的同级处加入过滤器,不然会导致应用图标在桌面消失等问题 -->
<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="ygmxapp" android:host="ygmx.app" android:pathPrefix="/openwith"/>
</intent-filter>
2.取值的话根据下面的代码进行取值
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");//name=zhangsan
String age= uri.getQueryParameter("age");//age=26
}
}