Android 自定义方案不适用于某些设备

发布于 2024-11-19 00:47:58 字数 1079 浏览 3 评论 0原文

我通过将其添加到 Android 清单中的活动中,为我的应用程序制作了自定义方案:

 <activity android:name=".TabHostActivity"
              android:label="@string/app_name"
               android:configChanges="orientation|keyboardHidden">
        <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.action.DEFAULT" />
                 <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.LAUNCHER" />
                 <data  android:scheme="myscheme" />
        </intent-filter>
    </activity>

当我在 Android 浏览器中写入“myscheme://”时,它会打开我的应用程序(在某些设备上)。问题是这不适用于 Samsung Galaxy s 和 Xperia play。它仅在 google 上搜索 myscheme:// 。

有谁知道这里出了什么问题吗?

任何帮助将不胜感激:)

I have made custom scheme for my app by adding this to my activity in the android manifest:

 <activity android:name=".TabHostActivity"
              android:label="@string/app_name"
               android:configChanges="orientation|keyboardHidden">
        <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.action.DEFAULT" />
                 <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.LAUNCHER" />
                 <data  android:scheme="myscheme" />
        </intent-filter>
    </activity>

When i write "myscheme://" i the android browser it opens my app (on some devices). The problem is that this is not working on the Samsung galaxy s and Xperia play. It only searches for myscheme:// on google.

Does anyone know whats wrong here?

Any help will be appreciated :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九公里浅绿 2024-11-26 00:47:58

浏览器通常会搜索某个术语或在其前面添加“http://”(如果该术语尚不存在)。我猜这就是这里发生的事情。

如果您创建一个包含 myscheme://something 链接的 HTML 页面,您的应用程序应显示在选择器列表中。

像这样的东西:
单击此链接

It's common for browsers to search for a term or prepend "http://" in front of it if it's not already present. My guess is that's what's happening here.

If you create an HTML page with a link to myscheme://something, your app should show up in the chooser list.

Something like this:
<a href="myscheme://it_worked"> click this link </a>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文