Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android in app subscription testing

I want to test the in app subscription mechanism on android devices(In app billing V3. api). How can I do this? I saw that testing with static responses is works only with the in app products. The beta/alpha testing supports the in app subscriptions?

Thank you.

like image 545
user3119267 Avatar asked Jan 24 '14 12:01

user3119267


3 Answers

You can test your app with in app purchase feature. you have to follow below steps for testing

  1. Upload you final signed apk file to Google play.
  2. Dont publish it
  3. Add in app products
  4. get in app products id and add to code
  5. get base 64 key and add to product
  6. sign apk and upload again
  7. your app should be in draft mode
  8. in you Google play account setting add your test account id
  9. use the device which should have the primary account id similar to the one you have added on Google play test account.
  10. Install signed apk you have uploaded to Google play to your device.
  11. run application and test your features
like image 90
Vaibhav Agarwal Avatar answered Sep 18 '22 02:09

Vaibhav Agarwal


Since there's no effective way to test subscription cancellation/renewal, I'm trusting Google's documentation that an expired subscription won't appear in purchased items (otherwise, whether cancelled but still valid, original or renewed, I don't care in my case).

To test the rest of my work flow I created a test consumable object so that I can re-buy/cancel it at will in the sandbox. This consumable simulates an active subscription. It's not full end-to-end testing, but given that Google's given us no better way to test subscriptions, it will at least give me a fair amount of confidence that my app behaves as expected, otherwise.

A few notes:

1) You can only test with a signed build. I added android:debuggable="true" to my AndroidManifest.xml (under <application android:debuggable="true"...)

2) This way I can still connect and debug with breakpoints after installing via adb (you can attach to the process under the Devices view, normally visible in the DDMS perspective, look for the little green bug icon.)

So far, it's behaving as expected. I'm still in the process of testing but if I hit any snags I'll update.

like image 40
Oded Avatar answered Sep 18 '22 02:09

Oded


In adittion to @Vaibhav-Agarwal if you only want test your app, you could have problems with the IDs (I have experienced with an app for a client).

In my case, to avoid this situation, I had to add a testing project with another special package (test.xxxx.xxxx.xxxx) and here add some in-app product with a trial of 7 days, then when I canceled a purchase I "only" had to wait 7 days to purchase again this subscription.

In this way also,you never had to make a refund, because the subscription with trial time, you haven't to pay until this trial time finish.

NOTE:

Draft Apps are No Longer Supported, you must use Alpha/Beta tester option

In spanish, you will read: "no se ha podido encontrar el elemento que intentabas comprar"

like image 23
Talek Avatar answered Sep 18 '22 02:09

Talek