Hyperlinks with non HTTP schema in GMAIL

六眼飞鱼酱① 提交于 2019-12-20 12:23:32

问题


So I'm making mobile apps and want to do links to activate things in both iOS and Android using the same URL. I know how to do this already. my intent on android is something like :

            <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="activity.action android:scheme="myapp"/>
            </intent-filter>

My problem is when I go to test this and want to do a hyperlink in an email myapp://activity.action is not recognized as a url in gmail on android and displays as plain text. is there a way to fix this? how do i get non standard schema recognized by gmail as a link?


回答1:


Custom schemes are not supported by gmail and chrome apps. Don't do this. Follow android guidelines for opening app from browser / link. See the following post Make a link in the Android browser start up my app?




回答2:


You can create intent filters for HTTP and HTTPS URLs as well as URLs with custom schemes.

For example, you might set up an intent filter like so:

<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="example.com"
        android:path="/my-path" />

</intent-filter>


来源:https://stackoverflow.com/questions/26186235/hyperlinks-with-non-http-schema-in-gmail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!