如何将Cordova应用添加到Android中的浏览器列表中

问题描述 投票:0回答:1

我想注册我的应用程序,以便Android将其识别为浏览器,以便用户在看到“打开方式”用于http链接时,可以选择我的应用程序。

是否有任何插件或配置要在配置中执行?

谢谢。

android cordova phonegap
1个回答
1
投票

我找到了我的问题的答案,我希望这可能会帮助其他人寻找这个问题。您可以参考Custom URL Plugin,它工作得很好,您只需将方案设置为“https”,以便您的应用程序接收https呼叫。

cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME=https

现在,如果您希望它也接受https并可能添加其他方案,您需要编辑AndroidManifest文件并添加意图:

 <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="https" />
        </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:scheme="http" />
        </intent-filter>

谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.