简体   繁体   中英

How to test In-app Billing on an emulator?

Is it possible to disable in-app billing/purchase and test my application on an Android Emulator? I want to do some functional testing of my application on multiple emulators. Later on I would test the 'in-app billing' on a real device.

Anyone have experience? How should I do this?

From Google: http://developer.android.com/guide/market/billing/billing_testing.html

To test in-app billing in an application you must install the application on an Android-powered device . You cannot use the Android emulator to test in-app billing . The device you use for testing must run a standard version of the Android 1.6 or later platform (API level 4 or higher), and have the most current version of the Android Market application installed.

  1. Install an emulator that has already google playstore installed, on a system image that supports google service api

My emulator spec:

Pixel 3a API 31
ABI: x86_64
System image: Android API 31 (Google Play)
  1. Create a closed testing track in google playstore console

  2. Add your gmail to license testing and closed testing email list

  3. Wait for your closed testing to be approved and available for testers.

  4. If you're using an existing emulator, please wipe data and cold boot

  5. Login as a tester account in gmail app as the first thing when you launch the emulator

  6. Browse closed testing invitation url, and accept invitation to take part in closed testing track

  7. IMPORTANT Make sure you're using the same application id (eg com.your.company.app ), version code (eg 1.3.0 ) and version name(aka build number) as the closed testing binary.

  8. That's all. Test payments in the emulator.

For step 2 ~ 4 you can refer to this wonderful doc from revenue cat: https://docs.revenuecat.com/docs/google-play-store

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