Skip to content

Instantly share code, notes, and snippets.

@dreamwhite
Created April 11, 2021 11:09
Show Gist options
  • Save dreamwhite/934e7d2bb9e1f2a89c5307485a5c3fb3 to your computer and use it in GitHub Desktop.
Save dreamwhite/934e7d2bb9e1f2a89c5307485a5c3fb3 to your computer and use it in GitHub Desktop.
[Google Sync Adapters] How to sync them with microG

Mammamia Marcello what's this?

I know what you're thinking of while reading this gist, but I don't have much spare time to setup a Nextcloud server for syncing my contacts and my calendar This guide is intended for those users like me (lazy af) who wanna sync contacts and calendar with Google server, even if using microG.

Requirements

How to proceed then?

First of all, in addition to a working TWRP, I'll assume that you know how to copy a file using adb, how to create a directory using mkdir.

Let's proceed by booting your phone in recovery mode, mount system in RW mode using Mount menu, and connect the phone to the PC. Run adb shell and create two folders onto /system/app using the below command:

mkdir -p /system/app/{GoogleContactsSyncAdapter,GoogleCalendarSyncAdapter}

Then, push the sync adapter(s) in the(ir) respective folder(s) using adb push:

Please don't forget to rename the adapters

#For contact syncing adapter
adb push GoogleContactsSyncAdapter.apk /system/app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk

#For calendar syncing adapter

adb push GoogleCalendarSyncAdapter.apk /system/app/GoogleCalendarSyncAdapter/GoogleCalendarSyncAdapter.apk

After doing so, give octal-permissions 644 to both files:

chmod 644 /system/app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk
chmod 644  /system/app/GoogleCalendarSyncAdapter/GoogleCalendarSyncAdapter.apk

At this point reboot your phone and give to the new installed adapters their respective permission using Settings/Apps/Show System App:

   Calendar permissions to Google Calendar Sync app
   (not sure why, but the Google Calendar Sync app had a "Contacts" permission and also an "Additional permissions" section with another "Contacts" switch with a different icon than the other one; to be sure I enabled both)

Lastly, open Settings/Accounts/Google/Account sync and flip Calendar and Contacts sync adapters

Credits

Please note that I do not own neither APKMirror nor Google Sync Adapter, nor microG nor whateveryouwant I just wanted to clarify the setup process for the install adapters after reading this issue

@nemozny
Copy link

nemozny commented Dec 28, 2023

Great, thanks!

Differences to Galaxy 5 (klte) on Android 11:
Recovery mode: 1. Mount, 2. Enable ADB

adb shell
klte:/ # mount
... omitted ...
/dev/block/mmcblk0p23 on /mnt/system type ext4 (ro,seclabel,relatime,discard)

Notice this is the system partition, and not only it is /mnt/system/system and not /system, but also RO. We need to umount and mount as RW.

klte:/ # umount /mnt/system
klte:/ # mount -o rw -t auto /dev/block/mmcblk0p23 /mnt/system/
klte:/ # mount

The last "mount" is to check that the partition remounted as RW. You can change "auto" to "ext4", if needed.
Then continue the guide above, only add /mnt/system to the path, so that

mkdir -p /system/app/{GoogleContactsSyncAdapter,GoogleCalendarSyncAdapter}

becomes

mkdir -p /mnt/system/system/app/{GoogleContactsSyncAdapter,GoogleCalendarSyncAdapter}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment