在Chrome浏览器中单击href时启动Android活动
我想在Chrome浏览器应用程序中的某个web中单击在Chrome浏览器中单击href时启动Android活动,android,intentfilter,Android,Intentfilter,我想在Chrome浏览器应用程序中的某个web中单击时打开我的应用程序的登录活动。我有此代码,但它不起作用: <activity android:label="@string/app_name" android:launchMode="singleTask" android:name=".activities.LoginActivity" android:screenOrientation="portrait"
时打开我的应用程序的登录活动。我有此代码,但它不起作用:
<activity android:label="@string/app_name" android:launchMode="singleTask"
android:name=".activities.LoginActivity" android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="myhost.com"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
我做错了什么
谢谢。您需要这样设置:
<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="example.com"
android:pathPrefix="/someresource/"
android:scheme="http" />
<data
android:host="www.example.com"
android:pathPrefix="/someresource/"
android:scheme="http" />
</intent-filter>
注意,在您的例子中,您需要使用android:pathPrefix而不是android:path