microG + Android Auto fully working

Search This thread

Rikj000

Senior Member
May 4, 2016
81
127
github.com
OnePlus One
OnePlus 2
That just sounds great!
As @Xurde78 already reported (and I repeatet the test), the King installer doesn't seem to work (in terms of faking the installation source). I used one of the already released Magisk packages that works fine for Maps or VLC, but not for any other navigation app. Installing OSMAnd~ by KingInstaller showed me in Setting/Apps/OSMAnd~/Appstore: Installed by Kinginstaller ...and it is not listed in Launcher. I belive you that it works for you, but why that works for us? Do you have an idea? I am on LOS20 too.

King-Installer v1.2 didn't work for me either on my LineageOS phone,
because we have a different `com.android.packageinstaller` provided by our ROM.

That's why I created King-Installer v1.3, with the "Enable if you use rooted (LineageOS) phone" checkbox.

Question: Do you see in the /settings/apps/xxx/app-shop really: Google Play Store?

Yes I do, you can check the proof I uploaded here, as a comment on my PR

Reading the full manual I see few difference:
* You install stubs and AA BEFORE installing the Magisk-AA-Module.
This is to make it less detectable that you're using modded software, however at the moment it's not a requirement.
(Currently AA will also be happy if you do not have the dependencies installed "as Google Play Store")

* You installed the stubs with King-installer too, but if that doesn't work with OSMand, why it should work with the stubs? Or does it more than fake installation source?
Did you try my v1.3 fork with the "Enable if you use rooted (LineageOS) phone" checkbox?
Also please re-visit the ReadMe, I've added new installation / usage instructions earlier today.
* You used Aurora root installation mode, while I used default (session installation?).
The "Root installer" of Aurora Store is a requirement to "install as Google Play".
I've checked the source code, and for as far as I researched it,
it was the only installation method which spoofed "com.android.vending" during installation.

Before I was using "Aurora Services" as the Aurora Store installation method,
which didn't work either.
 

starbright_

Senior Member
Apr 11, 2010
1,463
261
That might help others, but unfortunately this solution doesn't bring non-google navi-apps as "OSMAnd" or "here" alive in a LOS+microG environment.
 

Rikj000

Senior Member
May 4, 2016
81
127
github.com
OnePlus One
OnePlus 2
OsmAnd works correctly on my end.

To switch to my newer fork first:
1. Uninstall current AA updates
2. Uninstall current aa4mg v0.3-a13
3. Reboot

Then follow the instructions in the readme of my KingInstaller fork to install my v1.3 release.

After that follow the instructions in the readme of my aa4mg fork to reinstall AA with my aa4mg v0.4-a13 release.

Then you are ready to install OsmAnd as following:
- Download the latest OsmAnd .apk
- Open KingInstaller
=> Select File
=> OsmAnd .apk
=> Check "Enable if you use rooted (LineageOS phone)"
=> Install as King
=> Grant root permission
=> Wait for text-field with .apk path to clear

That's it, after thatOsmAnd should work.
Not tested in my car yet,
but shows up in launcher + works in head unit emulator.

I did not need additional AA-Tweaker tweaks,
nor did I need to modify the phenotype.db after installing as described above.
 

Attachments

  • 2023-04-02_22-10.png
    2023-04-02_22-10.png
    77.6 KB · Views: 23
  • 2023-04-02_22-09_1.png
    2023-04-02_22-09_1.png
    156.9 KB · Views: 22
  • 2023-04-02_22-09.png
    2023-04-02_22-09.png
    197.7 KB · Views: 23
  • 2023-04-02_22-08.png
    2023-04-02_22-08.png
    220.8 KB · Views: 22
  • Screenshot_20230402-221153_Android Auto_1.png
    Screenshot_20230402-221153_Android Auto_1.png
    147.2 KB · Views: 21
  • Screenshot_20230402-221211_Settings_1.png
    Screenshot_20230402-221211_Settings_1.png
    151 KB · Views: 20
  • Screenshot_20230402-224152_Settings_1.png
    Screenshot_20230402-224152_Settings_1.png
    145.6 KB · Views: 18
  • Screenshot_20230402-223918_Settings_1.png
    Screenshot_20230402-223918_Settings_1.png
    206.7 KB · Views: 19
  • Screenshot_20230402-223914_KingInstaller_1.png
    Screenshot_20230402-223914_KingInstaller_1.png
    202.7 KB · Views: 24

Xurde78

Member
Jun 29, 2020
24
6
Xiaomi Poco F1
It hasn't worked for me, but I'm getting more and more sure that it's my phone.
I have installed the module and the latest version of Kinginstaller, with the same result, installed apps show up in AA settings but not in AA launcher.
I have tried the repackaged Osmand and S2M applications with the same result.
Apps installed with King seem to be installed from the Fakestore, so it works fine.
With AA AIO TWEAKER I have tried to patch the applications, without result. Although I got the green tick that third-party applications were patched...
The phone was working fine, but I touched something but now it doesn't seem to turn on :( (but it was because of something I touched, both the module and the application worked without problem) :) it is an opportunity to do a clean installation of everything and re-approve .....
Question is there any Stub for GPlay .....?
 
  • Like
Reactions: Rikj000

starbright_

Senior Member
Apr 11, 2010
1,463
261
Question is there any Stub for GPlay .....?
Isn't fakestore a kind of stub? At least it is registering with same name (com.android.vending). Whether the name (here Fakestore) is of any meaning for other apps - I don't know.
Summery from me so far. Installation of AA was never as smooth and easy - but the KingInstaller doesn't seem to help (me) for navi-apps as OSMand. I am not aware of any mistakes while the installation, but I can't exclude that. Also I don't have a deeper understanding of how Google controls the navi apps - I just know they treated special for some reason.
So I am curious of feedback from others.

@Rikj000: your Magisk module contains stubs for Google, Maps, Speech. So why to install them before? Can you explain that detail?

@sn00x: does the magisk modules differ in other things than documentation?
 
Last edited:
  • Like
Reactions: Xurde78

Rikj000

Senior Member
May 4, 2016
81
127
github.com
OnePlus One
OnePlus 2
Isn't fakestore a kind of stub? At least it is registering with same name (com.android.vending). Whether the name (here Fakestore) is of any meaning for other apps - I don't know.

On MicroG,
FakeStore = Google Play Store = com.android.vending.

FakeStore is indeed a stub, provided by MicroG itself.

@Rikj000: your Magisk module contains stubs for Google, Maps, Speech. So why to install them before? Can you explain that detail?

You can also install them before/after AA,
the order doesn't matter, as long as they are installed once you are actually gonna use AA.

You can even freeze these dependencies through hail.

@sn00x: does the magisk modules differ in other things than documentation?
Nope, only docs are slightly different to assure the URLs on my fork repo work correctly.
 

sn00x

Senior Member
Oct 9, 2006
149
68
Fakestore is an empty package that mocks the existence of the Google Play Store to the Play Services client. Requires the FAKE_PACKAGE_SIGNATURE patch to be functional.

The main difference of the new release: It now ships with phenotype db, which AA uses to store information about launchable apps. You could try use AA Phenotype patcher (see github and thread) to enable your 3rd party apps.

I didn't test it myself though, cause I'm not even on A13, yet. Hopefully I will find some time soon (new phone is already here, just didn't have time to set it up, yet)
 

starbright_

Senior Member
Apr 11, 2010
1,463
261
You can also install them before/after AA,
the order doesn't matter, as long as they are installed once you are actually gonna use AA.
My question points to another direction. If the stubs are in magisk-aa module - why there is a need of manually install them? Why not install them in that step automatically (if not already existing). So you will have a choise:
Install the real apps either before magisk-aa or they will be installed as stubs in the magisk-aa module.
 

starbright_

Senior Member
Apr 11, 2010
1,463
261
aa4mg does not install any stubs.

You have to either:
- Manually install the stubs
- Update the aa4mg module code so it will install the stubs for you automatically.
That I understood, that is clear in your very good documentation! But why they are part of the module if they are not used in it? Don't get me wrong - its great to have them all available here, but they should they be outside of it or used. Otherwise some (like me) will ask : why that?
But finally it's no problem, I am just wondering why.
 

Rikj000

Senior Member
May 4, 2016
81
127
github.com
OnePlus One
OnePlus 2
That I understood, that is clear in your very good documentation! But why they are part of the module if they are not used in it? Don't get me wrong - its great to have them all available here, but they should they be outside of it or used. Otherwise some (like me) will ask : why that?
But finally it's no problem, I am just wondering why.
I did not include them in my pre-release module .zip as they are not required in there.

I think @sn00x added the .apk's in the module either:
- By accident
- For completion (mirror whole repo in .zip)
 

starbright_

Senior Member
Apr 11, 2010
1,463
261
Got it. But maybe the idea if installing the stubs - only if the real apps are not installed - is not so bad. That will speed up bring up AA even more.
 

byReqz

Senior Member
Jul 14, 2016
257
68
Just released my forks + opened PRs! 🎉
They should help with bringing better Anrdoid Auto support on (LineageOS based) MicroG devices.
Enjoy!
Nice. I was trying to rig up an "empty" phenotype DB for myself but it seems like I've been beaten. Is yours just copied from a device running real gms? As a sidenote, having a real phenotype DB also allows you to use https://github.com/shmykelsa/AA-Tweaker/ :) .
 

Rikj000

Senior Member
May 4, 2016
81
127
github.com
OnePlus One
OnePlus 2
Nice. I was trying to rig up an "empty" phenotype DB for myself but it seems like I've been beaten. Is yours just copied from a device running real gms? As a sidenote, having a real phenotype DB also allows you to use https://github.com/shmykelsa/AA-Tweaker/ :) .

Pulled the files from a rooted AVD without Google Account,
the phenotype.db is pre-patched with AA-Tweaker, but can be further modified if desired.

If you're interested,
wrote some more details about the files and my findings about em in this MicroG Github issue:
 

Rikj000

Senior Member
May 4, 2016
81
127
github.com
OnePlus One
OnePlus 2
OsmAnd works correctly on my end.

To switch to my newer fork first:
1. Uninstall current AA updates
2. Uninstall current aa4mg v0.3-a13
3. Reboot

Then follow the instructions in the readme of my KingInstaller fork to install my v1.3 release.

After that follow the instructions in the readme of my aa4mg fork to reinstall AA with my aa4mg v0.4-a13 release.

Then you are ready to install OsmAnd as following:
- Download the latest OsmAnd .apk
- Open KingInstaller
=> Select File
=> OsmAnd .apk
=> Check "Enable if you use rooted (LineageOS phone)"
=> Install as King
=> Grant root permission
=> Wait for text-field with .apk path to clear

That's it, after that OsmAnd should work.
Not tested in my car yet,
but shows up in launcher + works in head unit emulator.

I did not need additional AA-Tweaker tweaks,
nor did I need to modify the phenotype.db after installing as described above.

Figured out that I've missed a few steps there!

For OsmAnd and some other apps to show up / work correctly, you will also need to:
1. Install LSPosed
2. Install Fermata,
3. Enable the Fermata LSPosed module for AA
4. Reboot

I'll send in a PR with properly updated docs tonight after my work 🙂
 
Last edited:

Xurde78

Member
Jun 29, 2020
24
6
Xiaomi Poco F1
Figured out that I've missed a few steps there!

For OsmAnd and some other apps to show up / work correctly, you will also need to:
1. Install LSPosed
2. Install Fermata,
3. Enable the Fermata LSPosed module for AA
4. Reboot

I'll send in a PR with properly updated docs tonight after my work 🙂
You've done it
Pocophone F1
A12, CrDroid 8.12
MicroG Core 0.2.27.223616
AA 9.1.631044
Kinginstaller V1.3
Thank you very very much. Rikj000

byReqz starbright_

Thank you for your contribution and instructions.
It only remains to connect it to the car, but that is a small detail.
 

Attachments

  • WhatsApp Image 2023-04-05 at 16.55.53.jpeg
    WhatsApp Image 2023-04-05 at 16.55.53.jpeg
    59.2 KB · Views: 25

starbright_

Senior Member
Apr 11, 2010
1,463
261
Just be aware: If you wipe data/cache of your AA app (to do some kind of restart/refresh) ... some files of the magisk-aa module will be deleted!
That's an unexpected side effect.
 
  • Like
Reactions: Xurde78 and Rikj000

Rikj000

Senior Member
May 4, 2016
81
127
github.com
OnePlus One
OnePlus 2

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hello,
    aa4mg is a great Magisk module but I experienced some drawbacks ( bricked phone ) because of the permissions things. A simple use case : you start your smartphone in safe mode, magisk is deactivated : phone bricked. I tried to modify the configure.sh script for this, without sucess, sadly.
    Cheers,
    To prevent bootloops in the future,
    check out my Magisk module,
    Magisk Manager for Recovery Mode

    That way you can simply disable faulty modules straight from your custom recovery (e.g. TWRP).
  • 8
    This is how you can use Android Auto with microG and connect your phone with your car.

    Prerequisites:
    Android 10+
    Newest microG core (https://github.com/microg/GmsCore/releases)
    A custom recovery to flash a zip file

    Let's begin:

    For Android Auto we'll use nikgapps Android Auto add-on and modify one file in the flashable zip.
    Download nikgapps Android Auto add-on here: https://sourceforge.net/projects/nikgapps/files/Releases/
    Dpending on your Android version, choose the correct Addons-(Q/R) folder, then, you want to download "NikGapps-Addon-10/11-AndroidAuto-date-signed.zip"

    Now open the downloaded package and open the folder "common". In there you'll find "nikgapps_functions.sh". This file needs to be modified as follows:

    Open this file and search for "is_on_top_of_nikgapps"

    Remove the following (this code checks if you have installed nikgapps core already, but since we don't want to install that, it must be removed):
    Code:
    is_on_top_of_nikgapps() {
      nikgapps_present=false
      # shellcheck disable=SC2143
      if [ "$(grep 'allow-in-power-save package=\"com.mgoogle.android.gms\"' "$system"/etc/sysconfig/*.xml)" ] ||
            [ "$(grep 'allow-in-power-save package=\"com.mgoogle.android.gms\"' "$system"/product/etc/sysconfig/*.xml)" ]; then
        nikgapps_present=true
      fi
      addToLog "- Is on top of NikGapps: $nikgapps_present"
      if [ "$nikgapps_present" != "true" ]; then
        abort "This Addon can only be flashed on top of NikGapps"
      fi
    }

    It should look something like this now:

    Code:
    .....
        else
          addToLog "- Failed to write $install_location"
          abort "Installation Failed! Looks like Storage space is full!"
        fi
      fi
    }
    
    # Check if the partition is mounted
    .....

    That's it! Now you can flash this zip with your recovery and you'll have fully working Android Auto!
    6
    I just created a Magisk Module that provides Android Auto for devices running microG on Android 11. I've made this mainly for myself, but wanted to share:

    Basically just install aa4mg-v0.1.zip as Magisk Module, reboot, optionally upgrade in Aurora Store, profit.

    But please see readme on github: https://github.com/sn-00-x/aa4mg
    5
    I've merged @byReqz's pull request (thanks for the great contribution!) and released a new version: https://github.com/sn-00-x/aa4mg/releases/tag/v0.3-a13
    5
    Til now I didn't hear of anyone get it working on A13.
    I did it. You need a A13 LineageOS-20.0 rom with signature spoofing patch. Here is my patch https://github.com/braga2/sigspoof
    Apply that patch and build as described in official instruction https://wiki.lineageos.org/devices/barbet/build instead of barbet use your device codename. I built for my bluejay.
    Burn the ROM.

    Install Google APP Stub. I built it from sources from here https://git.sr.ht/~dylanger/Google-App-Stub
    Install Mozilla UnifiedNLP Backend from F-droid.

    Then you have to install latest MicroG GmsCore and FakeStore from official github https://github.com/microg as a regular apps with forceQueryable flag enabled. I used such commands:
    adb install --force-queryable FakeStore-v0.1.0.apk
    adb install --force-queryable com.google.android.gms-223616052.apk
    Enable signature spoofing for both these apps and other required permissions.
    Enable Mozilla UnifiedNLP (Mozilla Location Service) in MicroG.
    Of course you can disable internet access for this app and for MicroG as well.

    Then reboot to LIneage Recovery and install 'android auto stub'. I used latest NikGapps-Addon-13-AndroidAuto from official sourceforge https://sourceforge.net/projects/ni...n-13-AndroidAuto-20220908-signed.zip/download
    I installed it manually without using scripts. Mounted system in recovery, then mounted /product in adb and put these 3 files using 'adb push': AndroidAutoOverlay.apk into /product/overlay, AndroidAutoStubPrebuilt.apk into /product/priv-app/AndroidAutoStubPrebuilt and com.google.android.projection.gearhead.xml into /product/etc/permissions
    Maintain correct permissions for files root:rw-r-r and for AndroidAutoStubPrebuilt dir root:rwx-rx-rx

    Also important! grep gearhed /product/etc/permissions/* and remove or comment all xml permission tags except our installed file(com.google.android.projection.gearhead.xml). I found it in privapp-permissions-google-p-lineage.xml and commented whole corresponding xml tag so it looks like this:
    Code:
        <!--privapp-permissions package="com.google.android.projection.gearhead">
            <permission name="android.permission.ACTIVITY_EMBEDDING"/>
            <permission name="android.permission.BLUETOOTH_PRIVILEGED"/>
            <permission name="android.permission.CALL_PRIVILEGED"/>
            <permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
            <permission name="android.permission.COMPANION_APPROVE_WIFI_CONNECTIONS"/>
            <permission name="android.permission.CONTROL_INCALL_EXPERIENCE"/>
            <permission name="android.permission.DUMP"/>
            <permission name="android.permission.ENTER_CAR_MODE_PRIORITIZED"/>
            <permission name="android.permission.LOCAL_MAC_ADDRESS"/>
            <permission name="android.permission.LOCATION_HARDWARE"/>
            <permission name="android.permission.MANAGE_USB"/>
            <permission name="android.permission.MODIFY_AUDIO_ROUTING"/>
            <permission name="android.permission.MODIFY_DAY_NIGHT_MODE"/>
            <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
            <permission name="android.permission.REQUEST_COMPANION_SELF_MANAGED"/>
            <permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>
            <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
        </privapp-permissions-->

    Well. Reboot system now and install latest Android Auto, Google Maps, Google TTS from Aurora Store (or any other source).
    Enable location permission for GMaps and all permissions for Android Auto. Internet access for Android Auto can be disabled.
    Disable USB-debug in Android developer menu.
    Reboot the phone.
    Cross your fingers and try to connect to head-unit.
    When AA asks for maps location permission just hit Cancel.
    If it does not connect - disconnect USB cable and clear storage for GMaps and AA and try again. It should work!

    ps. Google Translate online does not work. It throws https 403 forbidden error but without MicroG it works fine.
    Also GMaps works only english US language. I could not switch it to any other language even if phone language was ok. I guess the reason is the same 403 error, google bans the requests to their services by some headers. I plan to reverse-engineer and fix this ;)
    4
    I have got in running finally on LOS19+microG, including OSMAnd and other Navi-apps and Screen2Auto. It was a long way to go. I try to summerize it:

    You can start here:

    I want to do a shortcut and put a recent AA into this package. (84624324). It is not as easy just to change the app, you also have to extract the libs from app and change that, but also change the permission.xml. You get the required data out of Manifest, decode the app with apktool
    Installation as it is described in the link.

    What drives me nuts was the thing about permission. Starting it in the car I get short after start a green screen with request to set location permission to Maps (although it was given - and it even shows my position). Not sure but maybe it was some location setting in microG that has to be called first.

    The next thing is to get other Navis than Maps running. It sees it needs to be installed from Playstore, but I don't have it on my device. But this can be faked.
    You have to install a few things: LsPosed, XPrivacyLua and its Pro-App.
    Installing is a bit of a pain, you have to enable XprivacyLua in LsPosed, check AA there (you have to unhide system apps) AND in XPrivacyLua
    It provides Hooks for 2 different AA versions. These have to be imported by the Pro Companion app and again activated in XprivacyLua.
    To figure out the values that has to be changed in the hook check the AA.apk with
    java -jar Bytecode-Viewer-2.11.2.jar and look for the string "isPackageAllowed3p". All credits go to "UnlockAA" who not only figured that out but alos helped me a lot with that.

    Screen2Auto works without root. But I need to enable the Alternative Touch method to get feedback from cars screen.
    With this you can mirror your phones screen, so no need for an app that is ready for AA.


    Although the orginal work has done by others (linked) I spend some hours to figure things out and get it working. Hope that will help others too.