我已经定义了一个意图过滤器,以便从某些类型的URL启动我的应用程序。关键是它针对所有类型的链接启动,而我只想针对具体的主机名启动。这是我的清单:
<activity
android:name="com.imin.SplashActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:logo="@drawable/img_action_icon"
android:screenOrientation="portrait"
android:theme="@style/AppTeme.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<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:host="imintheapp.com"
android:pathPrefix="/events/get/"
android:scheme="http" />
</intent-filter>
</activity>
在以下情况下,仅需要打开我的应用程序:http : //imintheapp.com/events/get/xxxxxxxx,其中xxxxxxxx是字母数字字符串。
我做错了什么?问候,
在Menifest.xml中添加此代码
<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:host="www.parag-chauhan.com"
android:path="/test"
android:scheme="http" />
</intent-filter>
为了进行测试,请创建另一个项目并运行以下代码
Intent i = new Intent(Intent.ACTION_VIEW , Uri.parse("http://www.parag-chauhan.com/test"));
startActivity(i);
您也可以pass parameter
在链接中获取更多信息http://paragchauhan2010.blogspot.com/2013/03/make-link-in-android-browser-start-up.html
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句