gpt4 book ai didi

Android - 将用户发送到应用程序的 android play 时出现奇怪的崩溃报告

转载 作者:太空宇宙 更新时间:2023-11-03 12:00:22 25 4
gpt4 key购买 nike

我有一个按钮,用户可以单击该按钮将他们发送到 Google Play 商店中的应用程序页面。这是我用于按钮的代码:

        Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.problemio"));
startActivity(intent);

包裹在这里:https://play.google.com/store/apps/details?id=com.problemio

有时它工作正常,但有时我会收到这样的崩溃报告:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.problemio }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
at android.app.Activity.startActivityForResult(Activity.java:2833)
at android.app.Activity.startActivity(Activity.java:2959)
at com.problemio.content.BusinessIdeasActivity$5.onClick(BusinessIdeasActivity.java:107)
at android.view.View.performClick(View.java:2538)
at android.view.View$PerformClick.run(View.java:9152)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3691)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)

知道为什么它只是有时有效吗?

谢谢!

最佳答案

我会为您的软件尝试一些不同的 URL:

    Uri uri = Uri.parse("market://search?q=pname:com.problemio");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
try {
this.startActivity(intent);
} catch (ActivityNotFoundException anfe) {
// Hmm, market is not installed
Log.w(TAG, "Android Market is not installed");
}

关于Android - 将用户发送到应用程序的 android play 时出现奇怪的崩溃报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10646109/

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