首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Android如何使用给定格式myapp://http://创建自定义URL方案

Android如何使用给定格式myapp://http://创建自定义URL方案
EN

Stack Overflow用户
提问于 2013-08-07 19:43:49
回答 3查看 37.5K关注 0票数 17

我已经研究了大多数自定义URL方案的问答,我还没有找到我可能的答案。

我希望我的应用程序通过在浏览器中单击某个URL (移动设备上的任何URL )来启动,问题是我给定的URL不能被修改,因为它也服务于IOS应用程序,它看起来像这样:

“我的应用程序://http://www.name.com/path/path2/

我不确定如何处理"myapp://http://“”并构造一个适当的意图过滤器,但我尝试的所有内容都不起作用。任何帮助都将不胜感激,如果我错过了相关的答案,请不要错过我的道歉。

这就是我到目前为止所尝试的:

代码语言:javascript
运行
复制
      <activity
        android:name="com.myapp.test.SplashScreen"
        android:exported="true"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <!-- Test for URL scheme -->
        <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="www.name.com"
                android:path="/path/path2/"
                android:scheme="http" />
            <data
                android:host="www.name.com"
                android:path="/path/path2/"
                android:scheme="https" />

            <data android:scheme="myapp" />
        </intent-filter>
        <!-- End Test for URL scheme -->
    </activity>

注意:我尝试过使用/不使用导出的:true

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18102528

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档