场景:经过浏览器打开URL或者扫描软件扫描URL来启动本地应用android
<intent-filter> <category android:name="android.intent.category.DEFAULT"></category> <action android:name="android.intent.action.VIEW"></action> <data android:scheme="sh"></data> </intent-filter>
这样即指定了接收Uri的Scheme为sh 且 Action为View的Intent。浏览器
利用以下Intent调用Activitythis
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("sh://123123123")));
在接收的Activity中使用以下代码得到数据spa
this.getIntent().getScheme();//得到Scheme名称 this.getIntent().getDataString();//得到Uri所有路径