相关疑难解决方法(0)

如何在Android上实现我自己的URI方案

假设我想定义一个URI,例如:

myapp://path/to/what/i/want?d=This%20is%20a%20test
Run Code Online (Sandbox Code Playgroud)

必须由我自己的应用程序或服务处理.请注意,该方案"myapp",而不是"http",或"ftp".这正是我的意图:为Android OS全局定义自己的URI架构.这可能吗?

这有点类似于某些程序已经在做的事情,例如Windows系统,例如Skype(skype://)或任何torrent下载程序(torrent://).

browser android uri intentfilter android-intent

159
推荐指数
5
解决办法
17万
查看次数

计划主机不在Android棒棒糖上工作,点击链接打开应用程序

我正在使用这段代码从链接启动我的应用程序.

<activity
        android:name="com.example.myApp.myClass"
        android:label="@string/app_name" >
    <intent-filter>
        <data
            android:host="customHostName"
            android:scheme="customScheme" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>  
Run Code Online (Sandbox Code Playgroud)

这是href链接,我想最终获得密钥.

customScheme://customHost/49FYTJTF00
Run Code Online (Sandbox Code Playgroud)

它在以前的所有Android版本上运行良好,但不适用于Lollipop.
当我点击链接时,它只显示要启动的浏览器列表.

我该怎么办?

android hyperlink intentfilter android-intent android-5.0-lollipop

16
推荐指数
2
解决办法
2万
查看次数