microg / GmsCore

Free implementation of Play Services
https://microg.org
Apache License 2.0
8.28k stars 1.7k forks source link

Contacts and Calendar Sync (Solved) #585

Open NolfNolfer opened 6 years ago

NolfNolfer commented 6 years ago

Please help me because I'm about to explode, as it's been 4 hours I'm trying to solve this.

Basically I clean installed lineageOS microg, and everything works, but I want to sync my calendar and my contacts.

I want an elegant and automatic solution, so downloading GoogleCalendarSyncAdapter solved the issue for the calendar sync without the Google Calendar app, but I'm currently stuck with no Contacts syncing, even though I've installed GoogleContactsSyncAdapter (version 9 that crashed, version 8.1 and other versions).

In settings, accounts, google, (mail account), there is NO contacts switch, only Gmail and Calendar appeared after rebooting.

Plus, when opened, gmail asks me to add an email account because it reads none (even though I logged in my two google accounts at the start of the lineageOS setup) and so I'm stuck there, and cannot read mails (if I receive a mail, I get the notification).

So, what do I have to do to have working Contacts sync and a working gmail?

EDIT: after logging out of an account and opening gmail again the other account showed up on the gmail starting page. From there I added the account I removed and then tapped on "take me to gmail", and now it works perfectly. However, I still need to find a solution to sync my Contacts

JonnyTech commented 6 years ago

https://github.com/microg/android_packages_apps_GmsCore/issues/222#issuecomment-261253801

NolfNolfer commented 6 years ago

Yes, I've already did the DAVdroid solution, but it only synced my contacts without calendar, and that is odd since the url "https://apidata.googleusercontent.com/caldav/v2/calid/events" should sync the calendar, not the contacts. So I've unistalled everything because I prefer "clean" solutions, and that solution solved my problem but has a distinct "it works? what the hell have I done?" feel to it.

I'd basically like to have something small, easy, elegant, easily comprehensible and easily backup-able and permanent. Installing the contacts sync apk should be the perfect solution (because it's the proprietary app and does everything automatically, so no risks of future incompatibility if Google decides to change stuff), however it doesn't make the "contacts" sync switch appear in the accounts settings, and I'd like to fix that to have something less invasive than the DAVdroid app (which btw I still can't understand why it synced contacts instead of calendar).

by the way, on https://developers.google.com/calendar/caldav/v2/guide, they say that the address in the post you linked "https://www.google.com/calendar/dav/my.email.address@google.com/events" is deprecated

Catfriend1 commented 6 years ago

I've also got this problem.with the google contacts sync some time ago and decided to put up a small zarafa activesync installation on a rasbpi and later used my nas for it. This is rather not a solution but a recommendation.

JonnyTech commented 6 years ago

No, use the link in the post - it works correctly: https://www.google.com/calendar/dav/my.email.address@google.com/events

Lanchon commented 6 years ago

somethings fishy. even though you load your account, some gapps wont see it; for instance gmail. i bet the sync app is affected by the same issue. look for the latest issue i started here regarding gmail. if you somehow solve that one, sync might start working. btw, note that sync apps need manual granting of rights; they dont expect not having them and thus they dont request them (last time i looked anyway).

NolfNolfer commented 6 years ago

Found the solution!

This will install the two official Google APKs that automatically sync google Contacts and Calendar to the device, so if you're concerned about privacy and stuff, DAVdroid could be the solution you're looking for.

However, they should just sync these two things and do nothing else, so you should be pretty safe, but in these privacy-rending, obscure times you can't even trust your mouse. Maybe your mouse is tracking what you do and how you move your hand, who knows.

Anyway, if you don't really care, and just want the damn instructions, go ahead:

1: download gapps; I used Open Gapps 2: open the archive and extract:

3: extract the respective APKs. If you can't open ".tar.lz" archives because reasons, convert them or find a tool that will open them. I converted them to .zip archives with https://convertio.co/it/tar.lz-tar/ and used winRar to extract them 4: send them to your device 6: mount /system as RW and put these two APKs in /system/apps in their respective directories (which won't exist and you will create), like this: /system/app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk /system/app/GoogleCalendarSyncAdapter/GoogleCalendarSyncAdapter.apk 7: IMPORTANT: set both APKs' permissions to 644 (Owner: read write, Group: read, Other: read)

8: Reboot

9: Open settings, apps, show system apps, then give:

10: Reboot again

11: ???

12: [Realizes there is no number 5]

13: [profits internally]

One final doubt: will a TWRP factory reset wipe these apps, even if they are system apps? From what I understand, a TWRP factory reset only wipes cache and data, while leaving the /system partition intact

sirocyl commented 5 years ago

@NolfNolfer from what I can tell, a data wipe will not delete the apps placed in the /system/ partition. However, any apecial permissions you set from the Settings app, will be erased, and will need to be reinstated manually.

I wouldn't say this solves the issue - your solution works, and makes your problem go away, but it certainly isn't within the scope of the microG project to recommend users to install a Google proprietary system app.

In the end, further research will need to be done, in order to properly implement Contacts, Calendar and other PIM syncing/storage functionality within microG, as the Google service would, with or without using Google PIM servers.

nitinjs commented 5 years ago

Found the solution!

This will install the two official Google APKs that automatically sync google Contacts and Calendar to the device, so if you're concerned about privacy and stuff, DAVdroid could be the solution you're looking for.

However, they should just sync these two things and do nothing else, so you should be pretty safe, but in these privacy-rending, obscure times you can't even trust your mouse. Maybe your mouse is tracking what you do and how you move your hand, who knows.

Anyway, if you don't really care, and just want the damn instructions, go ahead:

1: download gapps; I used Open Gapps 2: open the archive and extract:

* googlecontactssync-all.tar.lz from the Core folder

* calsync-all.tar.lz from the GApps folder (maybe the folder names and paths will change with other gapps? The archives names shouldn't though, so maybe you could search for the names and extract them)

3: extract the respective APKs. If you can't open ".tar.lz" archives because reasons, convert them or find a tool that will open them. I converted them to .zip archives with https://convertio.co/it/tar.lz-tar/ and used winRar to extract them 4: send them to your device 6: mount /system as RW and put these two APKs in /system/apps in their respective directories (which won't exist and you will create), like this: /system/app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk /system/app/GoogleCalendarSyncAdapter/GoogleCalendarSyncAdapter.apk 7: IMPORTANT: set both APKs' permissions to 644 (Owner: read write, Group: read, Other: read)

8: Reboot

9: Open settings, apps, show system apps, then give:

* Contacts permissions to the Google Contacts Sync 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)

10: Reboot again

11: ???

12: [Realizes there is no number 5]

13: [profits internally]

One final doubt: will a TWRP factory reset wipe these apps, even if they are system apps? From what I understand, a TWRP factory reset only wipes cache and data, while leaving the /system partition intact

awesome, it worked for me! 👍

billbarni commented 4 years ago

I always get errors when trying to convert or extract the tar.lz-tar files.

ac130kz commented 3 years ago

@billbarni got the same error, extracting on Android worked fine. However, when I try installing the app as shown above, the apps just disappear after a reboot, even though I set proper permissions and switch to RW

b0d8mr4zu commented 3 years ago

@billbarni tar can extract them directly. (assuming You're on linux)
tar --lzip -xvf googlecontactssync-all.tar.lz

@ac130kz You can use the terminal in the recovery (e.g. TWRP). You don't have to root the rom this way. You can mount the FS as read-write, add the dirs to system, copy apks to the corresponding dirs and chmod their permitions. No need for usb connection, you can type it on the device.

ac130kz commented 3 years ago

@b0d8mr4zu I moved to DAVx5, which works perfectly

b0d8mr4zu commented 3 years ago

@ac130kz andoid 11 will probably break DAVx5 although everything can be worked-around, but it's awesome it works for now.
I used a combination of DAVx5 for calendars from multiple accounts and GoogleContactsSyncAdapter as it's less likely to stop working unattended.

ac130kz commented 3 years ago

@b0d8mr4zu I've been using Android 11 for a month now, it doesn't seem like Google changed anything

dreamwhite commented 3 years ago

Found the solution!

This will install the two official Google APKs that automatically sync google Contacts and Calendar to the device, so if you're concerned about privacy and stuff, DAVdroid could be the solution you're looking for.

However, they should just sync these two things and do nothing else, so you should be pretty safe, but in these privacy-rending, obscure times you can't even trust your mouse. Maybe your mouse is tracking what you do and how you move your hand, who knows.

Anyway, if you don't really care, and just want the damn instructions, go ahead:

1: download gapps; I used Open Gapps 2: open the archive and extract:

* googlecontactssync-all.tar.lz from the Core folder

* calsync-all.tar.lz from the GApps folder (maybe the folder names and paths will change with other gapps? The archives names shouldn't though, so maybe you could search for the names and extract them)

3: extract the respective APKs. If you can't open ".tar.lz" archives because reasons, convert them or find a tool that will open them. I converted them to .zip archives with https://convertio.co/it/tar.lz-tar/ and used winRar to extract them 4: send them to your device 6: mount /system as RW and put these two APKs in /system/apps in their respective directories (which won't exist and you will create), like this: /system/app/GoogleContactsSyncAdapter/GoogleContactsSyncAdapter.apk /system/app/GoogleCalendarSyncAdapter/GoogleCalendarSyncAdapter.apk 7: IMPORTANT: set both APKs' permissions to 644 (Owner: read write, Group: read, Other: read)

8: Reboot

9: Open settings, apps, show system apps, then give:

* Contacts permissions to the Google Contacts Sync 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)

10: Reboot again

11: ???

12: [Realizes there is no number 5]

13: [profits internally]

One final doubt: will a TWRP factory reset wipe these apps, even if they are system apps? From what I understand, a TWRP factory reset only wipes cache and data, while leaving the /system partition intact

Hi there, I just landed there to let you know that I've published on a repository of mine a Magisk module which fixes this issue. Basically it installs as system-apps GoogleContactsSyncAdapter and GoogleCalendarSyncAdapter. You can get more infos here

Shalahuddin0 commented 3 years ago

@NolfNolfer thank you for the solution bro, I have managed to synchronize contacts on microG, I am very grateful

ibilux commented 2 years ago

Any update on properly implementing this in MicroG without using GoogleContactsSyncAdapter and GoogleCalendarSyncAdapter ?

drrossum commented 2 years ago

What is the point of sharing your information with Google but trying to avoid using their own method for doing so?

Lanchon commented 2 years ago

What is the point of sharing your information with Google but trying to avoid using their own method for doing so?

the point is different for each person. some might already have contacts on google and know that if true deletion is possible, it is pointless because your contacts use google anyway.

i am not so worried about google having my contact list at this juncture (but i hate ppl giving their contacts to app makers and google allowing this and not allowing me to opt out of other ppl giving my contact to 3rd parties). what i want to avoid is google being root on my computers: google not abiding by the privacy and security rules the force on to others, including the computer "owners" themselves. this is insulting and repulsive.

ibilux commented 2 years ago

What is the point of sharing your information with Google but trying to avoid using their own method for doing so?

If you used MicroG and Gapps you will see the difference in speed and ram usage and battery consumption (Huge difference). Also, if GoogleContactsSyncAdapter and GoogleCalendarSyncAdapter are implemented in MicroG, we wouldn't need to install them any more.

RobertoWa commented 2 years ago

you should put up with the fact that you have to use another program like davx to get this function.

Black6spdZ commented 2 years ago

you should put up with the fact that you have to use another program like davx to get this function.

no you don't have to use davx.. https://github.com/dreamwhite/gsync_adapters_for_magisk flash in magisk or recovery

dront78 commented 2 years ago

@ibilux how i can sync without installing the adapters? I'm using latest microg lineage and contacts are not synced.

ibilux commented 2 years ago

@dront78 currently there is no other solution than using these adapters.

bitmage commented 2 years ago

I'm on Android 12. OpenGapps 12 not yet available. Tried installing the two apks from BitGApps. Got them installed and set permissions, but nothing happens. Gave up.

This process feels a lot more painful than it needs to be. One contributing factor is a lack of any information about what's going on... is it syncing? Did it even try? What went wrong? I understand we're dealing with google code here, but I'm wondering if there's some way to view logs and troubleshoot. I agree with other posters, it seems like it would be valuable to implement this in microG for a better user experience. Or failing that, document a suggested path.

I did get calendar and contact sync working via DavX5 per instructions here. I appreciate that the DavX5 program has detailed information about the network requests it's making and what replies it is getting.

egpbos commented 2 years ago

Android 12 here too (Lineage 19.1), am also having issues with the latest available sync app from APKMirror, even though it says its minimum version is "Android 12+". I also installed the Google Contacts app. That one says it's trying to sync, but it has done so for the past two days and so my hopes are low that it will manage to sync my mere few hundred contacts.

darsaliq00 commented 2 years ago

@egpbos u tried nik gapps?

egpbos commented 2 years ago

No, I didn't know about that, but it seems like that does not use microG, so that's not really a solution for my situation. Thanks for the suggestion, though, maybe I'll try it some other time.

TheArkive commented 1 year ago

@NolfNolfer thanks!

This worked for me on LOS 18.1 (on OG Pixel XL-marlin) with one minor change:

Ten0 commented 9 months ago

For reference: iodéOS 20 (with Google Agenda app installed at least) doesn't require any additional installation for agenda sync to work, however contacts won't sync. So I uploaded a version of the magisk module that only installs the contacts fix: https://github.com/Ten0/gsync_adapters_for_magisk/releases/tag/69420-v420