point-of-sale-android-sdk
point-of-sale-android-sdk copied to clipboard
Always use playstore url.
The previous check and logic would crash on emulators with google APIs.
Can you provide more context about the crash? What's the stacktrace?
Using a http url means that the user gets a prompt between Chrome and Play Store, right? That's not great.
Here is the stack trace:
Process: com.example.hellocharge, PID: 2589
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.squareup flg=0x10080000 }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1809)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523)
at android.app.ContextImpl.startActivity(ContextImpl.java:791)
at android.app.ContextImpl.startActivity(ContextImpl.java:768)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:356)
at com.squareup.sdk.register.RealRegisterClient.openRegisterPlayStoreListing(RealRegisterClient.java:98)
at com.example.hellocharge.HelloChargeActivity$2.onClick(HelloChargeActivity.java:97)
at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:157)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
You can reproduce by using one of the standard (non-genymotion) emulators with google apis. Would it be better to catch the ActivityNotFoundException and then send them to chrome?
Cool. We definitely don't want to get rid of the market URL, but instead we can add an extra "can I use this intent" check.
The Play Store intercepts urls so there's no reason to use the market:// URI first.
On Thu, Dec 22, 2016 at 10:04 AM Pierre-Yves Ricau [email protected] wrote:
Cool. We definitely don't want to get rid of the market URL, but instead we can add an extra "can I use this intent" check.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/square/register-android-sdk/pull/21#issuecomment-268817748, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEbD6UO8VE30fLRQEIzKWR7I-UA_7ks5rKpGHgaJpZM4LIkt5 .
AFAIK all http schemes trigger a chooser intent between the browser and registered apps. This might have changed in recent Android versions (especially with App Link), but we're supporting down to 15 here, so I'm not sure if that's safe.
FWIW, I always Intent.setPackage("com.android.vending") to be safe when directing to the Play Store.