android 定义 程序 Scheme 接收特定URI开启Activity
android 定义 程序 Scheme 接收特定URI开启Activity
http://blog.csdn.net/csy172775922/article/details/6821651
首先在AndroidManifast.xml要被指定Scheme的Activity下设置如下参数
- <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调用Activity
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("sh://123123123")));
在接收的Activity中使用如下代码获得数据
- this.getIntent().getScheme();//获得Scheme名称
- this.getIntent().getDataString();//获得Uri全部路径

浙公网安备 33010602011771号