Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App with multiple User in Single Device - Inapp Billing Subscription

I am developing an application with subscription feature using Inapp Billing v3.There is login mechanism to access the application. If a user 'X' subscribes to a feature and logs out. If user 'Y' logs into application in same device and if the user attempts to subscribe, Google play tells that product is already bought. Are the subscriptions based on account synced in the device and not based on the user who logged onto the application? If so how is it possible to implement my scenario?

like image 725
androidGuy Avatar asked Apr 29 '13 17:04

androidGuy


People also ask

What is multi user app in Android?

Android supports multiple Users settings, applications, and data. Android Automotive relies on Android's multi-user support to provide a shared device experience, wherein each device User is intended to be used by a different physical person.

What is the use of multiple account app?

The app Multiple Accounts makes it easy to log into the apps on your Android device from various user accounts. This app makes it possible to use more than one account with apps like Telegram, Facebook, Instagram, Clash Royale, etc, from just one device.

Can you have multiple app accounts?

Using Dual Accounts in Duplicated Android AppsRunning multiple instances of an app lets you use multiple accounts for those apps on your phone. With this feature now built into your system, you don't need to go hunting for app-cloning tools.

How do I use a different account for in-app purchases on Google?

If you want to use a different Google Account, sign out of the app through the settings and sign in with your other personal Google Account. To switch Google Accounts, log out and sign back in with a different Google Account.


2 Answers

Google Play in-app billing subscription is bound to Google Play account. So as long and Google account is not changed the subscription is considered valid for this account and you cannot purchase it one more time.

If you want to substitute Google account system with your own accounts you need to "cheat" Google Play. What you can do is to create a pool of several different in-app billing subscriptions (like subscription #1, subscription #2, etc). When you subscribe you pass your own login as an additional parameter in developerPayload field.

Now when you enumerate all available subscriptions you check if there is one with current user account in the developerPayload field. If not, then you consider that current user has no subscription and allow to subscribe using the first not used yet subscription from the pool of subscriptions (subscription #1, subscription #2, etc) you generated. Just make sure that there is number of subscriptions in your pool is bigger than number of users on the same device you could have.

It is not a straightforward way, but rather a cheat to find a workaround for your situation.

like image 185
Vassili Philippov Avatar answered Sep 18 '22 04:09

Vassili Philippov


Currently google IAB supports only one account(Primary gmail account on device) on one device. But from Android 4.2 multiuser feature is available and google is working on giving same support for IAB.

like image 22
Ankit Avatar answered Sep 20 '22 04:09

Ankit