[Moto G4 Plus ROMs, Kernels, Recoveries, & Other De] Trademark97:
microG Installation Instructions

Seeing as there has been some interest in the exact procedure I used to get microG working on this ROM, I've decided to post for posterity the steps I used, so that others may attempt this endeavor if they are so inclined. If anyone attempts this guide and runs into difficulty, or just would like to make general inquiries about why I did this, please PM me with your questions. I may not respond right away, but I generally respond within 3 hours or less, unless it is night time in my timezone (CDT), in which case, I may not respond until some time in the morning.

Please note that all necessary links are available at the bottom of the post.

Here is the procedure I used:

1. Signature spoofing capability must be enabled by patching the system framework. This can easily be accomplished with an on-device patcher, such as the one from the NanoDroid project(1). This must be done *after* flashing the ROM (and optionally a root ZIP).

2. After the device is booted, the setup wizard finished, and ADB has been authorized, ADB should be given root permissions on the device (adb root) and the system partition should be remounted read-write (adb remount).

3. Then, the following apps should be installed:

GmsCore(2,3) - the part of microG that emulates the Play Services.

GsfProxy(4) - allows notifications via Google Cloud Messaging to work

Unified Network Location Provider(integrated into GmsCore) - provides location resolution capability, using either GPS or Wi-Fi signals to pin-point location

DroidGuard(5,6) - should theoretically allow the device to pass SafetyNet (this is only necessary if you need to pass SafetyNet to use certain apps)

Either a patched version of the Play Store(7), or FakeStore(8,9), which should allow apps to run and detect Play Services compatibility when used in conjunction with a store like the Yalp Store(10).

A location backend, such as NlpBackendIchnaea(Mozilla Location Service)(11,12), and/or NlpBackendNominatim(13), a backend that uses MapQuest's Nominatim service (based on OpenStreetMap) for geocoding.

NOTE:

All apps used except for DroidGuard should be installed as system apps. In particular, if Phonesky (Play Store) is to be used, it should be placed in /system/priv-app .

This can be done by pushing the apps from wherever they are downloaded on the computer by doing, for each app:

adb push <app_name>.apk /system/app
adb shell chmod 644 /system/app/<app_name.apk>

NOTE #2:

For Phonesky, remember to change the location to /system/priv-app, and changing the file permission is not necessary for this particular APK.

4. Reboot the phone.

5. Before you do anything else (such as installing another app), go into the microG Settings app, and complete all remaining items.

6. Reboot again.

7. Enjoy your newly Google-less phone!

Miscellaneous:

For microG system componentry, it is possible to use either the official APKs from the microG project, or the APKs available via the NanoDroid project. As of this posting, the APKs provided by the NanoDroid project contain PRs that have not yet been merged in the official upstream.

Links:

(1) - Signature spoofing patcher from NanoDroid

(2) - GmsCore - microG official version

(3) - GmsCore - NanoDroid version

(4) - GsfProxy - microG official version

(5) - DroidGuard Helper - microG official version

(6) - DroidGuard Helper - NanoDroid version

(7) - Phonesky (Play Store) - NanoDroid version (patched to allow in-app purchases with microG)

(8) - FakeStore - microG official version

(9) - FakeStore - NanoDroid version patched with CHECK_LICENSE permission enabled

(10) - Yalp Store - Download apps from Play Store without Google's proprietary app

(11) - MozillaNlpBackend - Mozilla Location Services location backend - microG official version

(12) - MozillaNlpBackend - Mozilla Location Services location backend - NanoDroid version

(13) - NominatimNlpBackend - Geocoding service using MapQuest's Nominatim service​

IMPORTANT DISCLAIMER (READ CAREFULLY):

I make no claim that microG will work for your exact scenario; you may have an app or apps that are not yet supported without the actual Google Play Services, instead of the compatibility layers that microG provides. Please also be aware that you must enable signature spoofing in order to allow microG to work, which could in theory be used by a rogue app to trick you into doing bad things with your data. Be careful, and only let microG have spoofing; no other apps should need it.

Good luck, and happy flashing!