Android Question InAppBilling3 and Accounts

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I am working on an application that is going to offer a subscription via InAppBilling using the InAppBilling3 library.

I am wondering how IAB works with multiple accounts (available since android 4.2? although my 2.2 device has multiple accounts). Using code found in another thread I'm able to get a list of all the device's accounts. When I purchase my subscription I see no way to specify which account will be used for the purchase. It always uses the first account (primary?) and I don't see any way to change the account used. Is there a way select the "current" account that will be used by IAB?

There is something called an "Account Picker". I've seen this on the Android Developers pages. I actually saw it pop up on my device once, but I don't know how I got it to pop up. Can this be used to choose one of the accounts to be the current account?

When I get "Owned Products" will this always be for the primary account?, will it be for the current account if that can be selected?, or will it be for all the device's accounts?

I will have another unrelated wrinkle. My app is designed to work even if off-line – no network connection – no fetching OwnedProducts. Is there a standard way to handle this situation? I am planning to store the OwnedProduct state when online and give a grace period if off-line. In general, is this how people implement this?

Thanks,
Barry.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Seems like the purchase will be tied to the currently active account: https://code.google.com/p/android/issues/detail?id=53307

I will have another unrelated wrinkle. My app is designed to work even if off-line – no network connection – no fetching OwnedProducts. Is there a standard way to handle this situation? I am planning to store the OwnedProduct state when online and give a grace period if off-line. In general, is this how people implement this?
This is the way to implement it. You should store the list of products in a local file.
 
Upvote 0
Top