[MOD][Xposed] XFBSync - Restore native FB contact sync via Xposed [CM10+]

Search This thread

agentdr8

Senior Member
Mar 4, 2007
3,648
1,896
Cowtown, CA
I built this module at @mew1033's request. Thanks to the guide by @pogi1100, I was able to mimic the steps needed to get this working. This has been tested on CM11 4.4.4 Nightly from 06-19-14, but it should work on older CM/AOSP releases as well. Most OEM builds from HTC, Samsung, LG, Sony, etc don't require this, as they modify the ContactsProvider themselves to allow Facebook syncing.

This module made it to the XDA Portal! Thanks!

Install steps:

  • Make sure you have the latest Xposed Framework installed
  • Make sure you enable the app_process from within Xposed Installer and reboot
  • Install attached apk, just like you would any other apk
  • Enable module in Xposed Installer, but don't reboot/soft-reboot just yet
  1. Open Settings->Accounts. If you have a Facebook account already added, remove it
  2. Click on your Google account, and under its sync preferences, uncheck the Contacts item
  3. Go back to Settings->Apps. Go to the All tab and find Contacts Storage. Clear the data
  4. Now you can soft/hard reboot
  5. When the phone is booted, go back into Settings->Accounts, select your Google account. Re-check your Contacts item
  6. When the Contacts are finished syncing, open the Facebook app and enter your login info
  7. Open Facebook->Settings and scroll all the way down to Sync Contacts
  8. Check either to Sync All, or Sync with Existing Names
  9. Go back to Settings->Accounts, pick your Facebook account
  10. You should see Contacts as an item and it should show the syncing status
  11. When the sync is done, open People and you should see all your FB contacts, with phone numbers and email addresses

Known Issues
If you have Privacy Guard, AppOps or any sort of privacy enhancer/app firewall, make sure you disable it for the Facebook app. This can prevent contact syncing from working.​
The module has been reported to work on the KK and older version of the FB app from v14 and older. Also reported to work on the most recent stable LP FB app (v34.0.0...) and for some, the most recent alpha version (v35.0.0...)​

Available via Xposed Repo as well (currently under Beta).

Source code can be found at my github

I've attached some screens showing the steps outlined above. It's pretty straight forward, but should be done in that order.

The latest version of the module now has a module icon (thanks to @-DM-) in Xposed Installer. If you don't like it or are offended by it, continue to use v1.2.5. The module icon is the only change.
 

Attachments

  • step1.png
    step1.png
    53.8 KB · Views: 11,226
  • step2.png
    step2.png
    30.6 KB · Views: 10,598
  • step3.png
    step3.png
    70.7 KB · Views: 10,082
  • step4.png
    step4.png
    59.2 KB · Views: 9,540
  • step5.png
    step5.png
    80.5 KB · Views: 9,624
  • step6.png
    step6.png
    54.6 KB · Views: 9,629
  • step7.png
    step7.png
    122.5 KB · Views: 10,511
  • step8.png
    step8.png
    52 KB · Views: 10,578
  • step9.png
    step9.png
    33.4 KB · Views: 10,244
  • step10.png
    step10.png
    57.7 KB · Views: 9,904
  • step11.png
    step11.png
    24 KB · Views: 9,701
  • XFBSync_v1.2.5.apk
    270.6 KB · Views: 622
  • xFBSync_v1.2.7.apk
    497.1 KB · Views: 1,320
Last edited:

Persechini

Senior Member
Mar 12, 2012
439
151
Rio de Janeiro
Hmm, I followed al the steps, Facebook setting show the option to sync contacts, but if I chose all contacts it auto changes to existing contacts, and despite Facebook showing up on the contacts app correctly now, even after letting all contacts sync, when showing only Facebook contacts the list is empty.Maybe some Facebook configuration is causing this trouble? It has all signs that it's working, but friends list visibility could mess this up right? Or its something else?

Enviado de meu Nexus 4 usando Tapatalk
 

jembot

Senior Member
Oct 24, 2007
299
136
Works great on XNote Touchwiz ROM! Finally a working facebook contact sync with phone numbers!..and no apk modification needed. Great work!

Btw, is there a way to backup the synced contact numbers to a file or merge it with your google account? I want to keep/archive the synced facebook info.
 
Last edited:

freedomtigers

Member
Sep 17, 2013
41
0
kerala
i did all things you described here
fb shows sync atlast

after it synced all contacts,
there is no fb contact.... (gmail contacts are there. no issue with them. and my phone contacts too)
the field is empty for fb contact

i did exactly as you described
and i selected contact display option for gmail and fb
still there is no fb contacts......

please help me......
 
Last edited:

agentdr8

Senior Member
Mar 4, 2007
3,648
1,896
Cowtown, CA
Hmm, I followed al the steps, Facebook setting show the option to sync contacts, but if I chose all contacts it auto changes to existing contacts, and despite Facebook showing up on the contacts app correctly now, even after letting all contacts sync, when showing only Facebook contacts the list is empty.Maybe some Facebook configuration is causing this trouble? It has all signs that it's working, but friends list visibility could mess this up right? Or its something else?

I can do some further testing tonight. I only added a single Google contact to my test account, so there weren't any contacts to match names with for the FB sync. I'm wondering if maybe that's throwing it off. I know that when I picked to display only FB contacts, the single Google contact disappeared and I only saw FB contacts.
 

agentdr8

Senior Member
Mar 4, 2007
3,648
1,896
Cowtown, CA
Works great on XNote Touchwiz ROM! Finally a working facebook contact sync with phone numbers!..and no apk modification needed. Great work!

Btw, is there a way to backup the synced contact numbers to a file or merge it with your google account? I want to keep/archive the synced facebook info.

Contact merging is usually handled by the Contacts/People app itself I think. It doesn't merge the data together, but just combines multiple contacts with the same name under a single contact entry. If you want to extract data from one contact type and add to another, you'd probably want to export all contacts from say FB and then import them into your Google account via the web.

Try displaying only FB contacts and there might be an Import/Export option in the menu.
 

agentdr8

Senior Member
Mar 4, 2007
3,648
1,896
Cowtown, CA
i did all things you described here
fb shows sync atlast

after it synced all contacts,
there is no fb contact.... (gmail contacts are there. no issue with them. and my phone contacts too)
the field is empty for fb contact

i did exactly as you described
and i selected contact display option for gmail and fb
still there is no fb contacts......

please help me......

That indicates that the database wasn't successfully modified with the new column. Is your contacts2.db located at /data/data/com.android.providers.contacts/databases?
 

agentdr8

Senior Member
Mar 4, 2007
3,648
1,896
Cowtown, CA
Does this work on stock/almost stock Android (Nexus, Moto X/G/E)?

In theory it should work on any 4.1+ rom that has the contacts2.db file located at /data/data/com.android.providers.contacts/databases. If it's located somewhere else (maybe under /data/data/com.android.contacts/databases?) let me know and I can adjust the mod accordingly.
 

Persechini

Senior Member
Mar 12, 2012
439
151
Rio de Janeiro
In theory it should work on any 4.1+ rom that has the contacts2.db file located at /data/data/com.android.providers.contacts/databases. If it's located somewhere else (maybe under /data/data/com.android.contacts/databases?) let me know and I can adjust the mod accordingly.

on aosp contacts2.db is indeed in the /data/data/com.android.providers.contacts/databases folder, so that doesn't looks like it's the issue

PS: it would be cool if you added this module in the xposed repository (setting this build as experimental to avoid overly heated complaints, of course), you might gather enough user/developer attention to help spread this feature that, in my opinion, is long overdue. Thanks for taking a shot to make it work
 
Last edited:

agentdr8

Senior Member
Mar 4, 2007
3,648
1,896
Cowtown, CA
on aosp contacts2.db is indeed in the /data/data/com.android.providers.contacts/databases folder, so that doesn't looks like it's the issue

I can post up a debug build if you're willing to send a logcat/error.log from Xposed

PS: it would be cool if you added this module in the xposed repository (setting this build as experimental to avoid overly heated complaints, of course), you might gather enough user/developer attention to help spread this feature that, in my opinion, is long overdue. Thanks for taking a shot to make it work

Done. Link on OP.
 

Wondersnite

Member
Jan 27, 2013
7
3
This has been long overdue in the Facebook app! Is there any way this could sync photos in higher quality though?
 

Persechini

Senior Member
Mar 12, 2012
439
151
Rio de Janeiro
Here it the error.log

Code:
-----------------
24/06/2014 02:54:24 UTC
Loading Xposed v54 (for Zygote)...
Running ROM 'KTU84P' with fingerprint 'google/occam/mako:4.4.4/KTU84P/1227136:user/release-keys'
Loading modules from /data/app/com.dr8.xposed.XFBSync-1.apk
  Loading class com.dr8.xposed.XFBSync.Mod
[2014-06-23 23:54:47] XFBS: init contacts providers package
[2014-06-23 23:54:47] XFBS: db has been modded, no need to check
[2014-06-23 23:55:06] XFBS: in facebook platformstorage class
[2014-06-23 23:55:08] XFBS: in facebook platformstorage class
 

freedomtigers

Member
Sep 17, 2013
41
0
kerala

agentdr8

Senior Member
Mar 4, 2007
3,648
1,896
Cowtown, CA
Here it the error.log


Code:
-----------------
24/06/2014 02:54:24 UTC
Loading Xposed v54 (for Zygote)...
Running ROM 'KTU84P' with fingerprint 'google/occam/mako:4.4.4/KTU84P/1227136:user/release-keys'
Loading modules from /data/app/com.dr8.xposed.XFBSync-1.apk
  Loading class com.dr8.xposed.XFBSync.Mod
[2014-06-23 23:54:47] XFBS: init contacts providers package
[2014-06-23 23:54:47] XFBS: db has been modded, no need to check
[2014-06-23 23:55:06] XFBS: in facebook platformstorage class
[2014-06-23 23:55:08] XFBS: in facebook platformstorage class


When you installed this version, did you start over and reset your contacts/accounts?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 49
    I built this module at @mew1033's request. Thanks to the guide by @pogi1100, I was able to mimic the steps needed to get this working. This has been tested on CM11 4.4.4 Nightly from 06-19-14, but it should work on older CM/AOSP releases as well. Most OEM builds from HTC, Samsung, LG, Sony, etc don't require this, as they modify the ContactsProvider themselves to allow Facebook syncing.

    This module made it to the XDA Portal! Thanks!

    Install steps:

    • Make sure you have the latest Xposed Framework installed
    • Make sure you enable the app_process from within Xposed Installer and reboot
    • Install attached apk, just like you would any other apk
    • Enable module in Xposed Installer, but don't reboot/soft-reboot just yet
    1. Open Settings->Accounts. If you have a Facebook account already added, remove it
    2. Click on your Google account, and under its sync preferences, uncheck the Contacts item
    3. Go back to Settings->Apps. Go to the All tab and find Contacts Storage. Clear the data
    4. Now you can soft/hard reboot
    5. When the phone is booted, go back into Settings->Accounts, select your Google account. Re-check your Contacts item
    6. When the Contacts are finished syncing, open the Facebook app and enter your login info
    7. Open Facebook->Settings and scroll all the way down to Sync Contacts
    8. Check either to Sync All, or Sync with Existing Names
    9. Go back to Settings->Accounts, pick your Facebook account
    10. You should see Contacts as an item and it should show the syncing status
    11. When the sync is done, open People and you should see all your FB contacts, with phone numbers and email addresses

    Known Issues
    If you have Privacy Guard, AppOps or any sort of privacy enhancer/app firewall, make sure you disable it for the Facebook app. This can prevent contact syncing from working.​
    The module has been reported to work on the KK and older version of the FB app from v14 and older. Also reported to work on the most recent stable LP FB app (v34.0.0...) and for some, the most recent alpha version (v35.0.0...)​

    Available via Xposed Repo as well (currently under Beta).

    Source code can be found at my github

    I've attached some screens showing the steps outlined above. It's pretty straight forward, but should be done in that order.

    The latest version of the module now has a module icon (thanks to @-DM-) in Xposed Installer. If you don't like it or are offended by it, continue to use v1.2.5. The module icon is the only change.
    5

    Had some issues decompiling the new FB apk. Will be a few days til I get a chance to do some testing.
    4
    In SlimKat ROM is working contacts sync with Facebook. I have working option with Facebook applications to check contacts sync. But only profile photo is syncing and very bad quality. Maybe it will be helpful to see haw they do that.

    The newer FB apps are still checking for the unrestricted_packages array, but not in the same location code-wise as the previous versions. It's just a matter of finding it and overwriting the return value.

    Also, the low-res picture sync has always been a shortcoming of the FB contact syncing. That's why there are alternative apps that do high-res photos. I had started doing some preliminary work on incorporating high-res photo syncing but ran into some roadblocks. If I can get the contact sync working again, I might have time to look into the photos as well.
    4
    this method not working after the last update to Facebook app.
    i got this method working for an older version before. [with very low pic quality - please try to improve this too]
    now it is gone.

    i don't updated my os...........

    Yes I'm aware. Facebook broke my module by moving things around within their app. The 14.x versions still work, but anything after that doesn't.

    High-res contact pictures aren't a priority since there are a few apps out there that already do this. My priority at this point is to get the module working with the latest version of the FB app.
    3
    Grrr. Facebook needs to calm down with their updates until I get this sorted :|