gpt4 book ai didi

Android 从带参数的二维码启动应用程序

转载 作者:可可西里 更新时间:2023-11-01 19:06:05 26 4
gpt4 key购买 nike

我想知道是否可以在 android 中使用二维码阅读器启动应用程序。我想要实现的目标是:

I create QR Code and after scanning it with QR Code reader I need to start my application with some params, maybe it will looks something like this : myApp://org.hardartcore.myApp?myParams or maybe something similar to this, not really sure.

有没有办法实现这一点并获取在二维码中构建的参数,目的是启动应用程序。

最佳答案

使用此文本创建二维码:myApp://extraString 并使用任何二维码阅读器读取它。或者您甚至可以使用 Zxing 的开源集成您自己的二维码阅读器。您可以使用 getIntent().getDataString() 获取 @Sean Owen 提到的 extraString。并且不要忘记将此添加到您的 list 文件中:

<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="myApp"/>
</intent-filter>

这应该有效。

关于Android 从带参数的二维码启动应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10258633/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com