简体   繁体   中英

How to test Android Pay with a debug APK?

By default, Android Pay refuses to work in debug builds, which makes testing tricky. What we've done so far is to actually merge new code into a develop or hotfix branch so our build environment will make a signed APK which can be tested. This is not ideal.

https://developers.google.com/android-pay/get-started states "Note: Our test environment will not return live, chargeable tokens in the FullWallet response, but will allow us to test your pre-purchase flow. You will see an Unrecognized App error on the Android Pay chooser until your app has production access." which isn't too promising.

https://developer.android.com/google/play/billing/billing_testing.html suggests testing with specially configured static responses for "reserved product IDs", which would be a nuisance to set up and not a true test. The other option they offer is to publish the app to an alpha or beta channel, which would, of course, be a signed APK. https://stripe.com/docs/mobile/android has a suggestion about "TEST_GATEWAY_TOKEN" but isn't really helpful in learning how to use Android Pay in test.

We even talked to a Google Developer Advocate, who did nothing but cut and paste some of the same documentation.

Is there any way to do a good test using an unsigned build? It would be wonderful to test Android Pay functionality successfully on a local developer machine.

No, there is not a debug mode option to that per docs:

https://developer.android.com/google/play/billing/billing_testing.html

set a separate machine with a CI server and have it do the alpha and beta builds for testing Google Play.

It is a pity but you have only one way to test IAP:

  1. Grant testing permission to your google accout used at your device
  2. Build .apk file.
  3. Upload it to your account at GoolePlay as beta version
  4. Wait until uploaded .apk processed
  5. Try do to actions you need and check it.
  6. If any issues - fix them and start from p. 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM