简体   繁体   English

自定义URL方案不启动Android应用程序

[英]Custom URL Scheme not launching the android application

I have implemented the code for the URL Scheme as shown below in manifest.xml. 我已经实现了URL Scheme的代码,如manifest.xml中所示。 this code is not working for any browser. 此代码不适用于任何浏览器。

<activity
        android:name=".Event"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar"
        android:windowSoftInputMode="adjustPan|stateAlwaysVisible" >
        <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="http" android:host="xyz" />
        </intent-filter>
    </activity>

The below code is working only for default browser. 以下代码仅适用于默认浏览器。

<activity
        android:name=".Event"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar"
        android:windowSoftInputMode="adjustPan|stateAlwaysVisible" >
        <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="xyz"  />
        </intent-filter>
    </activity>

so, please give me the solution to work custom URL Scheme with any browser or what i have to change in above code for this problem. 所以,请给我解决方案,使用任何浏览器工作自定义URL方案或我必须在上面的代码中更改此问题。

To first code: adding android:pathPattern=".*" should fix it for http scheme. 要第一个代码:添加android:pathPattern=".*"应该为http方案修复它。

To second code: for Chrome you have to use intent: syntax. 要获得第二个代码:对于Chrome,您必须使用intent: syntax。 Chrome does not listen to custom schemes (any more). Chrome不会再听取自定义方案了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM