Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-app purchase support #309

Closed
acsway878787 opened this issue Feb 12, 2017 · 63 comments
Closed

In-app purchase support #309

acsway878787 opened this issue Feb 12, 2017 · 63 comments
Milestone

Comments

@acsway878787
Copy link
Contributor

acsway878787 commented Feb 12, 2017

I installed Google Play store and microG service core. I found that In-app purchase sometimes worked and sometimes not. So is In-app purchase official support?

@mar-v-in
Copy link
Member

I can't test IAP so I can't support it. If it doesn't work and you find any issues in the log, you can report them here and I might try to handle them.

@ale5000-git
Copy link
Member

@acsway878787: The best way to get the problem fixed is to post a logcat when the problem happens.

@Nanolx
Copy link
Contributor

Nanolx commented Mar 21, 2017

Logcat between when trying to buy something. I can't get it to work with any custom ROM, though it works fine on Samsung TouchWiz. TouchWiz ROMs are granting much more permissions to system apps by default (alteast for MM, haven't tested Nougat). Though, for this test I used my lux (Moto X Play) with Ressurection Remix. Framework patched using Haystack and latest microG (0.24-79) with DroidGuard, GsfProxy, PlayStore (7.6.08.N).

03-21 18:09:26.403  2380  3653 W ActivityManager: Unable to start service Intent { act=android.support.customtabs.action.CustomTabsService pkg=com.android.chrome } U=0: not found
03-21 18:09:26.447  6554  6554 D AndroidRuntime: Shutting down VM
03-21 18:09:26.453  6554  6554 E AndroidRuntime: FATAL EXCEPTION: main
03-21 18:09:26.453  6554  6554 E AndroidRuntime: Process: com.android.vending, PID: 6554
03-21 18:09:26.453  6554  6554 E AndroidRuntime: java.lang.SecurityException: uid 10124 cannot get user data for accounts of type: com.google
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:1684)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.os.Parcel.readException(Parcel.java:1637)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.accounts.IAccountManager$Stub$Proxy.getUserData(IAccountManager.java:887)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.accounts.AccountManager.getUserData(AccountManager.java:402)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.auth.o.a(SourceFile:107)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.auth.a.a(SourceFile:143)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.lightpurchase.al.a(SourceFile:6940)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.common.g.v(SourceFile:265)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.common.g.a(SourceFile:260)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.lightpurchase.l.a(SourceFile:34708)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.lightpurchase.al.U(SourceFile:945)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.lightpurchase.al.T(SourceFile:884)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.lightpurchase.al.S(SourceFile:868)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.lightpurchase.al.A(SourceFile:20108)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.lightpurchase.e.j.x(SourceFile:20128)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.google.android.finsky.billing.lightpurchase.d.c.onClick(SourceFile:200)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.view.View.performClick(View.java:5637)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.view.View$PerformClick.run(View.java:22433)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:751)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6176)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
03-21 18:09:26.453  6554  6554 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
03-21 18:09:26.456  2380  4406 W ActivityManager:   Force finishing activity com.android.vending/com.google.android.finsky.billing.lightpurchase.PurchaseActivity
03-21 18:09:26.473  2380  4406 W ActivityManager:   Force finishing activity com.android.vending/com.google.android.finsky.billing.lightpurchase.LightPurchaseFlowActivity
03-21 18:09:26.523  2380  4406 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:877 com.android.server.am.AppErrors.crashApplicationInner:375 com.android.server.am.AppErrors.crashApplication:309 com.android.server.am.ActivityManagerService.handleApplicationCrashInner:13686 com.android.server.am.ActivityManagerService.handleApplicationCrash:13668 
03-21 18:09:26.527  2380  4406 E ActivityManager: Sending non-protected broadcast projekt.substratum.APP_CRASHED from system 2380:system/1000 pkg android
03-21 18:09:26.527  2380  4406 E ActivityManager: java.lang.Throwable
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at com.android.server.am.ActivityManagerService.checkBroadcastFromSystem(ActivityManagerService.java:18106)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:18695)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:18786)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at android.app.ContextImpl.sendBroadcast(ContextImpl.java:881)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at com.android.server.am.AppErrors.crashApplicationInner(AppErrors.java:375)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at com.android.server.am.AppErrors.crashApplication(AppErrors.java:309)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:13686)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at com.android.server.am.ActivityManagerService.handleApplicationCrash(ActivityManagerService.java:13668)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:1660)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2980)
03-21 18:09:26.527  2380  4406 E ActivityManager: 	at android.os.Binder.execTransact(Binder.java:565)
03-21 18:09:26.573  2380  2503 W BroadcastQueue: Permission Denial: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to de.amazon.mShop.android/com.amazon.mcc.crashreporter.android.CrashReportBroadcastReceiver requires android.permission.READ_LOGS due to sender android (uid 1000)
03-21 18:09:26.574  2380  2503 W BroadcastQueue: Permission Denial: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to de.amazon.mShop.android/com.amazon.mcc.crashreporter.android.CrashReportBroadcastReceiver requires android.permission.READ_LOGS due to sender android (uid 1000)
03-21 18:09:26.658  2380  6364 I OpenGLRenderer: Initialized EGL, version 1.4
03-21 18:09:26.658  2380  6364 D OpenGLRenderer: Swap behavior 1
03-21 18:09:26.974  2380  2503 W ActivityManager: Activity pause timeout for ActivityRecord{7376ff9 u0 com.android.vending/com.google.android.finsky.billing.lightpurchase.PurchaseActivity t4 f}
03-21 18:09:28.132  2380  4406 W ActivityManager:   Force finishing activity com.android.vending/com.google.android.finsky.billing.lightpurchase.PurchaseActivity
03-21 18:09:28.149  2380  4406 W ActivityManager:   Force finishing activity com.android.vending/com.google.android.finsky.billing.lightpurchase.LightPurchaseFlowActivity
03-21 18:09:28.153  1566  1566 W SurfaceFlinger: couldn't log to binary event log: overflow.
03-21 18:09:28.171  2380  4406 W ActivityManager:   Force finishing activity com.android.vending/com.google.android.finsky.activities.MainActivity
03-21 18:09:28.247  2380  4406 E ActivityManager: Found activity ActivityRecord{c8ed575 u0 com.android.vending/com.google.android.finsky.activities.MainActivity t4 f} in proc activity list using null instead of expected ProcessRecord{e8453f1 6554:com.android.vending/u0a124}
03-21 18:09:28.293  2380  4406 I ActivityManager: Killing 6554:com.android.vending/u0a124 (adj 100): crash
03-21 18:09:28.301  2380  4406 D ActivityManager: cleanUpApplicationRecord -- 6554
03-21 18:09:28.307  2380  2504 W art     : Long monitor contention with owner Binder:2380_8 (4406) at void com.android.server.am.AppErrors.crashApplicationInner(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo, int, int)(AppErrors.java:385) waiters=0 in void com.android.server.am.ActivityManagerService.unregisterReceiver(android.content.IIntentReceiver) for 112ms
03-21 18:09:28.308  2380  2504 W InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
03-21 18:09:28.373  2380  4408 W ActivityManager: Unable to start service Intent { act=com.google.android.gms.measurement.START pkg=com.google.android.gms } U=0: not found
03-21 18:09:28.375  2380  4406 W ActivityManager: Unbind failed: could not find connection for android.os.BinderProxy@5db1cb0

@Ningyoplug
Copy link

I'm having problems with inapp purchases as well. As soon as I press "buy" to confirm the purchase, it tells me Google Play store has stopped.

@ShapeShifter499
Copy link

Same issue, Google Play store has stopped. I can't make any in app purchases in Pokémon GO. No I'm not cheating, this is the standard apk from the Play store. I'll try to take a log later.

@Nanolx
Copy link
Contributor

Nanolx commented Apr 1, 2017

@mar-v-in did you have a chance to have a look at my logcat yet?

@ShapeShifter499
Copy link

@mar-v-in Here's a logcat, taken from boot all the way till I attempt a purchase in Pokemon GO and I see "Google Play Store has stopped" message.
Pokemon_GO-In_App_Purchase-microG-logcat.txt

@ShapeShifter499
Copy link

I'd like to see this resolved so I added $5 to Bountysource

@mar-v-in
Copy link
Member

mar-v-in commented Apr 3, 2017

The problem is that Play Store tries to call a method that it is only allowed to call if Play Services and Play Store are signed with the same key. As this is not the case when using microG with original Play Store, it crashes.

There are three solutions to this problem, one uglier than the other:

  • Sign Play Store and microG with the same key (and use signature spoofing on play store to have it look like Google signed). There won't be Play Store builds signed with the official microG key, but you can still do it yourself.
  • Modify Play Store to not do this call (possibly using Xposed).
  • Modify the operating system to allow Play Store to do this method call (possibly using Xposed).

This problem was not present in older Play Stores afair so you might as well be able to just downgrade it.

@mar-v-in mar-v-in changed the title In-app purchase support ? In-app purchase support ? [$5] Apr 3, 2017
@mar-v-in mar-v-in added the bounty label Apr 3, 2017
@ShapeShifter499
Copy link

@mar-v-in Which version do I try? If I try the one suggested in the "Flashable Zip by @ale5000-git", Google Play Store 5.1.11, some apps get blacklisted from downloading. I'm guessing because Google thinks my device is running too old of a Operating System due to a out of date Google Play Store.

@mar-v-in
Copy link
Member

mar-v-in commented Apr 3, 2017

@ShapeShifter499 I can't help you there, I never used original Play Store.

@ShapeShifter499
Copy link

@mar-v-in "Sign Play Store and microG with the same key" Does there need to be any changes to the current code? Or should this work right now if I attempted it? Any caveats to this?

@mar-v-in
Copy link
Member

mar-v-in commented Apr 3, 2017

You won't be able to update microG through F-Droid or Play Store anymore and you need to add signature spoofing the Play Store (similar to how it is done in microG), which requires some modification of Play Store's AndroidManifest.xml

@ShapeShifter499
Copy link

That's to much work every time I want to update microG, or when there is a Google Play Store update, or even when I want to update my ROM.

"Modify the operating system to allow Play Store to do this method call" -- This seems like the best way, maybe it can be added to the set of patches already in use. But I'm just pulling things out of thin air at this point, I don't have much knowledge past this point.

@mar-v-in
Copy link
Member

mar-v-in commented Apr 3, 2017

@ShapeShifter499 this modification would be about reducing android's security by punching a hole in it's security system. I will not write or support such a patch. The best solution IMHO would be a Xposed module, but I won't be the one to create it.

@Nanolx
Copy link
Contributor

Nanolx commented Apr 3, 2017

@mar-v-in thanks for that solution! I re-signed microG GmsCore and Play Store with the same (debug) signature and modified Play Store Manifest for correct fake signature: et voila. It's working.

I test-bought that 0,10 € Piano app Google is currently offering.

The only thing I notices so far is that my only installed paid app on my Moto X Play (Flux Substratum Theme) needed to be re-installed to verify the purchase process. Haven't tested on my Tablet yet, where I have a few paid games installed. Maybe all paid apps need a re-installation if not coming from a clean flash, but that's only a one-timer.

If someone wants to give it a try:

Install at your own risk, Play Store TOS violation, bla, bla.

[The strange thing is: on TouchWiz ROMs (atlest Marshmallow, haven't tested Nougat) Samsung has made so many changes to the framework files that in-app-purchases work just perfect with only patching framework files using tingle/haystack. Also Maps is auto-granted permission to accounts, unlike on other ROMs where you manually have to allow it, else it won't find the account.]

@mar-v-in mar-v-in changed the title In-app purchase support ? [$5] In-app purchase support ? [$15] Apr 3, 2017
@Nanolx
Copy link
Contributor

Nanolx commented Apr 3, 2017

I added 10 $ to the bounty for native solution, btw.

@Ningyoplug
Copy link

Nanolx, do i just have to install the two apks you linked for it to work properly or do I need to do something else? If I need to do womething else, then could you tell me the steps?

@Nanolx
Copy link
Contributor

Nanolx commented Apr 3, 2017

@Ningyoplug install them the same way you did with the original ones, so usually both in /system/priv-app/

@Ningyoplug
Copy link

@Nanolx trying to install your gmscore but it tells me "the package appears to be corrupt"

@Nanolx
Copy link
Contributor

Nanolx commented Apr 3, 2017

@Ningyoplug move it manually into /system/priv-app/ replacing the original file and reboot. The solution with the debug-signed apks is a bit tricky.

@Ningyoplug
Copy link

@Nanolx I don't even have a Phonesky folder in priv-app.... and Play Store keeps giving me "server error" and idk how to fix it.

@Nanolx
Copy link
Contributor

Nanolx commented Apr 3, 2017

@Ningyoplug Dunno, you can either try my whole project, checkout http://www.github.com/Nanolx/NanoMod, be sure to read all of README. I uploaded a snapshot zip: https://www.androidfilehost.com/?fid=745425885120721657 In case you wanna try, be sure to move any further discussion to the NanoMod repository (as it's not related to microG).

Or wait for someone to add native (in-)app-purchase support to microG.

@ShapeShifter499
Copy link

@Nanolx I tried your package, same issue.

@ShapeShifter499
Copy link

I even tried uninstalling and reinstalling problem apps

@Nanolx
Copy link
Contributor

Nanolx commented Apr 4, 2017

Clear PlayStore data. Might give that a try, else please a logcar in the other git repo.

@Nanolx
Copy link
Contributor

Nanolx commented Apr 4, 2017

I created a new snapshot of my Magisk Module. Many internal changes, especially now possible for example to only populate microG (see part "Alter Installation" in the README).

Edit: beta 3 with installer changes.

@WanderMax
Copy link

WanderMax commented May 24, 2017

OK 92. I will try 81.Thanks.
@ale5000-git
does location needed? I find some map tools can get location info without the Nlp check passed.
how to block play store self update? change version number?
or
adb shell pm disable com.android.vending/com.google.android.finsky.autoupdate.ReschedulerUsingJobScheduler$CheckPreconditionsAndAutoUpdateJobService
adb shell pm disable com.android.vending/com.google.android.finsky.autoupdate.ReschedulerUsingAlarmManager$CheckWifiAndAutoUpdate
adb shell pm disable com.android.vending/com.google.android.finsky.autoupdate.ReschedulerUsingBroadcast$AutoUpdateRecheckForBroadcast
?

@WanderMax
Copy link

@ale5000-git how to disable play store auto update?

@fred0r
Copy link

fred0r commented Feb 25, 2018

It would be really nice if 'more google api's' would be supported.
Plenty of my paid Apps dont work :*(

@godfuture
Copy link

I am having big trouble with Yatse. A kodi remote. Currently the best way to get it running is the Google Play store license API.

Any plans or ideas for 2019?

@Nanolx
Copy link
Contributor

Nanolx commented Dec 8, 2018

Licenses and their validation are part of what you do as part of a purchase contract with Google, thus validation only works with Play Store and this won't change. Basically any license validation outside from verified Google data could be misused and is in most countries illegal anyway.

Some apps like Titanium or Tasker allow for license verification without Play Store, but that's only a minority of apps and each does it in a different way.

In your particular case I don't know about Yatse, but as an alternative Kore is available on F-Droid.

@Nanolx
Copy link
Contributor

Nanolx commented Dec 13, 2018

So, since I provide a Play Store that works for (in-)app-purchases with microG since over a year now, I guess I can claim those 15$? For those curious:

And this issue can be closed as "fixed externally"?

@fred0r
Copy link

fred0r commented Dec 16, 2018

my 2 cents: sounds legit. . .

@Happyfeet01
Copy link

How you have updated the Apps? @Nanolx
I can't use inapp Billing.

@coxtor
Copy link

coxtor commented Apr 18, 2019

@Nanolx
Hi, I am coming from a clean install on lineage 16.0 Magisk + Nanodroid + Nanodroid Repository using your modified Play Store. All appears to work fine however, I can not download any of my purchased items, even though I can see them in my purchase history in the same app. Furthermore Applications using in app purchases do not recognize purchased in app purchases. However, if I attempt to purchase the item again, I get a toast message that I already own the item. This message does not unlock the items functionality though. The Logcat does not show any failures just many reauths.
Any advise?

@Nanolx
Copy link
Contributor

Nanolx commented Apr 18, 2019 via email

@coxtor
Copy link

coxtor commented Apr 18, 2019

Wow - that was a simple fix. I enabled SafteyNet in the settings app as you suggested and it started to work.
Thank you. At this point it might be worth mentioning that the options in the app which can be enabled are not quite clear and what their functions imply. Perhaps a label below the options would help other users?
What would be the point of having only SafetyNet enabled or only the device registration or any other combination? I would love to contribute this information however I do not have the necessary knowledge.

Furthermore could you elaborate on the modification you made to the play store at some point if you have time? Is there more telephoning home going on, or is this removed also? How invasive and nosy is the modified play store with microg installed?

@Nanolx
Copy link
Contributor

Nanolx commented Apr 19, 2019

Yes, an ordinary user may want to simply enable all device registration, GCM and SafetyNet, but there are users who don't. The wiki could be improved, yes, I had in mind to spend some time improving it, though that's not going to be soon™.

The changes I made to the Play Store is only so that it uses signature spoofing and disabling most of it's update checks (to reduce battery drain to a minimum; else Play Store would endlessly try to update Play Services and itself, contributed by @Vavun), to ensure it's signature in-system is the same as microG's else security checks will not allow (in-)app-purchases if the don't match.

You can find the patch here, currently version 14.5.52: https://gitlab.com/Nanolx/NanoDroid/blob/master/doc/Phonesky.diff

@MartinX3
Copy link

@Nanolx
People like me who wants to use the Aurora Store are still excluded.

External workarounds doesn't seem to be valid fixes in my opinion.

@Nanolx
Copy link
Contributor

Nanolx commented Sep 17, 2019 via email

@MartinX3
Copy link

MartinX3 commented Sep 17, 2019

But your play store hack is a license violation either.
So this issue can't ever get fixed (external).

That's sad, since that's the only issue for me to switch to microG forever.

@Nanolx
Copy link
Contributor

Nanolx commented Sep 17, 2019 via email

@MartinX3
Copy link

MartinX3 commented Nov 11, 2021

Sadly there was no update since 10 months from @Nanolx and accordingto a bug report, it won't work with LineageOS 18.1 (Android 11) :(
So back to OpenGapps Pico :(

https://gitlab.com/Nanolx/microg-phonesky-iap-support

@mar-v-in mar-v-in added this to the 0.3.1 milestone Mar 19, 2024
@mar-v-in mar-v-in changed the title In-app purchase support ? [$15] In-app purchase support Mar 21, 2024
@mar-v-in mar-v-in removed the bounty label Mar 21, 2024
@mar-v-in
Copy link
Member

Initial experimental support for in app billing (purchases and subscriptions) landed in master.

@Vavun
Copy link
Contributor

Vavun commented Mar 23, 2024

Initial experimental support for in app billing (purchases and subscriptions) landed in master.

What about a new nightly for testing please?

@Atemu
Copy link

Atemu commented Mar 23, 2024

The commit for reference: d4d7713

How does that work? Do you still need the Play Store installed to facilitate the purchase?

@mar-v-in
Copy link
Member

You need latest version (0.3.1) of microG Services and microG Companion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests