【问题标题】:How to get the parameters when launch my app with url?使用 url 启动我的应用程序时如何获取参数?
【发布时间】:2016-03-21 11:12:36
【问题描述】:

我在 Manifest 中添加了一个过滤器,以使浏览器能够启动我的应用程序,就像这样

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="test"
                android:scheme="myapp" />
        </intent-filter>

但是我得到了带有参数的重定向地址:“myapp://test?param1=123&param2=456”

如何打开我的应用并获取这些参数?

【问题讨论】:

标签: android url parameters launch


【解决方案1】:

我们在活动的 onCreate 方法中将参数作为附加项。 要访问它,请使用:

getIntent().getExtras().getString("param1");

【讨论】:

    猜你喜欢
    • 2015-03-29
    • 1970-01-01
    • 2014-10-22
    • 2015-12-03
    • 2012-11-10
    • 2013-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多