Paid apps from Google Play Store (including in app purchases / license checks)

Continuing the discussion from OBDLink app unable to load add-ons:

Preamble:
This is about using Google stuff. If you want to keep your phone 100% Google free, stop reading!
Nevertheless, in some scenarios this might be the lesser of two evils, if the other is to go back to a fully Google bloated stock ROM.

There may be situations when you inevitable need paid apps from the Google Play Store. In many cases you can simply use the Aurora Store to install apps you bought (just buy the app from a web browser by visiting https://play.google.com). But if you somehow must be able (or simply want to) use an app with an in app license check or in app purchases, Aurora Store can’t help you.

 

One thing you can do in this case is to separately install the Google Play Store app. Be aware, this theoretically gives Google already full control over your phone, as if you’re running a Stock-Google ROM. If you’re nevertheless still willing to continue, this is how it’s done:

  1. Prerequisite: You got TWRP and/or Magisk installed and you know how to get a root shell on your device.

  2. Place a textfile in the user accessible storage (at /data/media/0, so right beside the folders Download, Bluetooth, …): .nanodroid-setup
    This is the file content:
    (most important part is the nanodroid_play=10, see also here)

nanodroid_microg=0
nanodroid_nlpbackend=0000
nanodroid_mapsv1=0
nanodroid_play=10
nanodroid_fdroid=0
nanodroid_apps=0
nanodroid_overlay=1
nanodroid_bash=0
nanodroid_init=""
nanodroid_gsync=0
nanodroid_swipe=0
nanodroid_forcesystem=0
  1. Install NanoDroid-microG-*.zip either via TWRP or via Magisk.
    (the .nanodroid-setup file will tell NanoDroid how to install)
    Then reboot.
    See also: gitlab.com/Nanolx/NanoDroid

  2. Grant “Signature spoof permission” to the customized Play Store by NanoDroid. You must do this as root on a shell in the running eOS-Android (not from TWRP).
    pm grant com.android.vending android.permission.FAKE_PACKAGE_SIGNATURE

  3. Reboot

  4. You maybe need to repeat at least step 3 (install NanoDroid) after an /e/ eOS update.

 

Appendix:

Many paid apps it might need the Play Store just one time to check their license. So it might be OK to disable the Play Store app, disable the Magisk NanoDroid module or even completely uninstall NanoDroid after the paid app got what it needed.

One time I observed a problem where the name of the microG Settings app and some other strings inside the app somehow “changed”. E.g. the name of the microG Settings app became no longer installed, although it was still working. See here for details:

2 Likes

Thanks for posting the steps clearly. It’s unfortunate that there seems to be no way around getting Phonesky / Play Store for (in-)app-purchase support.

As you noticed, the downside of this is that NanoDroid seems to override some settings in the pre-installed microG in /e/, at least on the unofficial ROM by steadfasterX that I use. Plus rooting seems to be required at some point to grant signature spoofing permissions.

Kind of messy whichever way it is approached, whether with the app or with Magisk, etc. It would be nice to have a ROM that already has the patched Play Store already installed to avoid messing things up, but that raises other concerns. I just haven’t yet found an elegant solution to license verification of app add-ons.

Using a shell as root to run a command is not the same as rooting the phone.
You can get a rooted shell via ADB by enabling Rooted debugging in the Developer options, then running adb root on the computer to restart ADB with root permissions, and then running adb shell … a “#” instead of a “$” sign in the shell prompt should indicate success.
Rooted debugging can be disabled again once done.

1 Like

It is hard to leave apps that you’ve loved and used for years but can no longer be used because of the absence of Google Play on the phone. For example, when I installed /e/, I had to leave Rocket Player, my favorite music app, IsoTimer, a great calendaring and organizing app and AccuBattery behind because of their dependence on Google or Google play. I did find a wonderful replacement for Rocket Player (AIMP - it was like finding an old friend :slight_smile: ) and Simple Calendar does an adequate job but AccuBattery was not replaceable.

Sometimes, to do the right thing, sacrifices must be made … :smiley:

The free version AccuBattery can be installed with Aurora Store and does not require the (patched) Google Play Store. Not sure about the pro version. If it involves a license check, that’s what this thread is about.

I encountered some problems trying to follow the steps (with TWRP not Magisk):

If nanodroid-setup contains nanodroid_overlay=1 the system does not boot to /e/ after installing the NanoDroid-microG-*.zip package. It times out while booting the ROM, then reboots into recovery. I think it may be due to permissions issues.

I uninstalled NanoDroid with the uninstall zip package, then rebooted, but there were many permissions that had been reset to defaults and microG was completely gone from the system…

After reinstalling NanoDroid in TWRP with nanodroid_overlay=0 the system booted, microG was present but with different settings than originally from my ROM. The Google Play Store was present and its app Protect scan ran automatically.

However, granting the fake signature permission did not work:

h812_usu:/ # pm grant com.android.vending android.permission.FAKE_PACKAGE_SIGN>
Security exception: Permission android.permission.FAKE_PACKAGE_SIGNATURE is not a changeable permission type

java.lang.SecurityException: Permission android.permission.FAKE_PACKAGE_SIGNATURE is not a changeable permission type
	at com.android.server.pm.permission.BasePermission.enforceDeclaredUsedAndRuntimeOrDevelopment(BasePermission.java:402)
	at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:1475)
	at com.android.server.pm.permission.PermissionManagerService.access$1000(PermissionManagerService.java:89)
	at com.android.server.pm.permission.PermissionManagerService$PermissionManagerInternalImpl.grantRuntimePermission(PermissionManagerService.java:2174)
	at com.android.server.pm.PackageManagerService.grantRuntimePermission(PackageManagerService.java:5545)
	at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:1730)
	at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:217)
	at android.os.ShellCommand.exec(ShellCommand.java:103)
	at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21608)
	at android.os.Binder.shellCommand(Binder.java:634)
	at android.os.Binder.onTransact(Binder.java:532)
	at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2821)
	at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3955)
	at android.os.Binder.execTransact(Binder.java:731)

Of course, I made a backup before trying any of this so I’m back to where I started.

It would be nice to be able to install the patched Play Store without having to install microG via NanoDroid, since that installation/uninstallation seems to mess with the /e/ ROM which already comes with microG.

That was the problem - I had purchased AccuBattery and the paid version doesn’t work without that license check. The free version - they changed how the free version operates so that now it is very, very limited in what it can do. I did contact the programmer about it and asked if there was a way to use AccuBattery without the Play Store but I was told that there were no plans on making AccuBattery Google-free. With everything that’s going on, maybe I should ask again … :smiley:

Yes, the first thing to do is ask the developer for an alternative. But that often does not result in a solution. At least it didn’t for the app I’m interested in.

I tried the above again, but this time with Magisk and succeeded. It worked before/without the step for granting spoofing permissions too. Btw, I got the same bizarre “problem” about the changed name for microG.

After getting the add-ons validated in the app of interest (OBDLink) I disabled NanoDroid (and thus the Google Play Store) in Magisk, and the add-ons continue to work. I could just re-enable it in case I need to validate more add-ons. I suppose I could even remove Magisk at this point, but I might keep it around for a while.

I think you may find that you will need to jump through those hoops again if the app updates or even, in some cases, if you reboot your phone although in the case of your app, that doesn’t seem to be an issue.

You may want to disable auto-updates.

Good point. I’m curious what will happen after an app update.

Yes, the add-on functionality seems to survive phone reboots.