user3493858
user3493858

Reputation: 51

How to share in-app-purchases between two Android apps

I have two android apps (app1 and app2), both of them are free but app2 contains an in-app-purchase upgrade.

Now I'm going to merge those two apps into the app1 (the one without the in-app-purchase).

My questions are:

Thanks

Upvotes: 5

Views: 1241

Answers (2)

EvilDuck
EvilDuck

Reputation: 4436

It is not possible via In-App purchases API, but there are a couple of ways to work around this:

  1. Build your own backend for both apps and synchronize purchases. If you don't want to build entire backend yourself, you can use firebase authentication + firebase database. The obvious drawback, of course, is having to build and maintain backend, make users create an account, which will increase friction.
  2. If your users use will have both apps installed on your device, you could always expose a ContentProvider that shares the purchase information with another app. You can make it secure by checking the signature of a caller package and verifying it's the officially downloaded app. Alternatively to ContentProvider you could expose a service in one of the app and connect to it via AIDL from another app or you could have both apps share the user id and communicate directly. Drawback is having to ask your users to have both apps installed.

Upvotes: 1

Grant Amos
Grant Amos

Reputation: 2256

Unfortunately, this is not possible. The in-app purchases are directly tied to the unique package-id used when the applications were first created.

The only way you could preserve app2's in-app purchase would be to merge app1 into app2, thus preserving the app's purchases. Finally, if that won't work, you'd have to hand roll a solution using a service other than Google Play Services.

Upvotes: 1

Related Questions