【问题标题】:Protocol not supported android协议不支持安卓
【发布时间】:2011-11-02 21:30:03
【问题描述】:

我在尝试从浏览器获取链接以启动我的活动时遇到此错误

08-24 16:38:13.877: ERROR/Tab(358): onReceivedError -10 wizi://logout The protocol is not supported.

<activity android:name="UrlActivity">

<intent-filter>
<category android:name="android.intent.category.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"/> 
<category android:name="android.intent.category.LAUNCHER"/> 
<data android:scheme="wizi" />

</intent-filter>
</activity>

UrlActivity 调用onCreate() 之前抛出此错误,有人能看出我做错了什么吗?

【问题讨论】:

    标签: android android-manifest intentfilter browsable


    【解决方案1】:

    尝试同时给出方案和主机 -

    <data android:scheme="wizi" android:host="logout"/>
    

    【讨论】:

    • 谢谢我试过了,真的希望有多个链接具有相同的方案但不同的主机,例如 wizi://logout、wizi://login 等
    • 在这种情况下,Android 官方文档说您可以对主机使用 URL 模式,包括 Asterik (*)。
    • 从 Android 开发者网站复制粘贴:星号 ('') 匹配从 0 到多次出现的前一个字符的序列。因为在从 XML 读取字符串时(在将其解析为模式之前)使用 '\' 作为转义字符,因此您需要双重转义:例如,文字 '' 将被写为“\*”。
    • 这个建议并没有解决我的问题。更多信息:我正在使用 Cordova,Cordova 2.7 中不存在问题,Cordova 3.0 中存在。
    【解决方案2】:

    您是否在任何链接中使用 HTTPS 协议?如果是这样,那么您需要接受证书。确保您的网址中的协议标识符正确无误。

    【讨论】:

      猜你喜欢
      • 2018-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      相关资源
      最近更新 更多