Android 不能同步Facebook联系人
2013-11-07 11:55
417 查看
FaceBook Sync for Android ICS Devices [ Updated Aug 01 '12 ]
May29, 2012Androidandroid, facebook, tweaks
— 转自:http://niranjanthilak.com/facebook-sync-for-android-ics-devices/
If you are one of the unlucky ones who can’t make the original Facebook Application to sync its contacts with your phone / Google contacts on Custom ROMs such as AOKP , ( CyanogenMod ) CM9 or MIUI . This solution
is the solution for you. It ‘will make the original FB application Sync it’s contacts with the Contacts app. I’ve created a flashable zip method using CWM and another one using ADB+Windows as well.
This will enable Sync dialog on the original Facebook application , just like it used to do on Gingerbread.
Update [Aug 1] : Files Updated.
Based on MIUI 2.7.27 , CM9 2012-07-31 & AOKP]MileStone 6
Update ->I won’t be able to update the files weekly anymore. But i will try to update them whenever i can get them to be updated.
Files are available at the bottom of this post.
Read the instructions if you don’t want to see a lot of FC’s popping up.
Note:
If the Contact Pictures are not loading, give it some time and keep the contacts application on with internet connected. It is slow , and it is because
of slow FB servers.
If this whole thing leaves you into a bootloop ( very unlikely ) or lot of FC’s ( very much likely if you didn’t reboot / if you flashed the wrong zip ) , You can reflash your current ROM to fix it. Eg: If you were on the CM9 2012-07-31 ,
flash the CM9 2012-07-31.zip again over your phone. No need to wipe and no need to format to revert this -hack- back.
PreRequisites
You should have ClockWorkMod ( CWM ) Recovery in your phone for doing it via Method#1.
You should be having atleast one account or phone number in the phone book , This is to ensure that contacts database is intialized. So -DO NOT- flash this directly after wiping
or installing a new ROM, do it after a boot.
Method#1 Using ClockWorkMod Recovery
Files : Download the corresponding file from below( Filenames have date and ROM mentioned)Steps:
Copy the appropriate ZIP file for your phone/ROM to your SD card.
Reboot your phone to recovery mode . You will need ClockWorkMod Recovery 3+ for this tweak to work.
Go to ‘Mounts and Storage’. Mount ‘data’ ( and ‘datadata’ if it is present ). This step is very important.
Choose update from sdcard.
Locate the ZIP file and update it.
Reboot.
Add FB account ( FB accounts which you had added before wont sync properly, so delete it and add again).
Sync it.
Method#2 - Using Windows+ADB .
Files : Download the corresponding file from below( Filenames have date and ROM mentioned)Download the ‘FBSync_ADB_xx’ zip file corresponding to your ROM.
Extract it to a folder. For eg: to your desktop.
Connect your phone in debug mode. ( You can enable debugging mode from your phone Under Development > Enable Debugging mode ) .
Run patch_db.cmd with administrator privileges ( this is a must if you have UAC enabled ). For this, Right click ‘patch_db.cmd’ and select ‘Run as Administrator’
Reboot the phone.
Warning
If you wipe the phone/contacts, you will have to flash the zip again.Flash it after booting it once onto your phone and adding an account other than FB, preferably. This is to ensure that the database has been created. If you already have accounts , clear them , leave one phone contact preferably.
I’m not responsible for any data loss. If you mismatch the ROM and ZIP then it’s bound to soft-crash the phone.
Detailed Explanation:
Facebook application can sync its contacts with the Contacts ( Through ContactsProvider ) only when its whitelisted ( or, in other words , given an escalated permission set ) in the ROM.For this , You have to edit the ContactsProvider.apk and add the whitelisted permission.
For editing the ContactsProvider.apk ( Which resides in the /system/app/ directory) ,You will need smali
( An assembler/disassembler for Android’s dex format ).
After disassembling the ContactsProvider.apk using smali , Go to the res/values/ folder ( in the disassembled source ) , and add the file ( arrays.xml ) containing the following content:
<?xml version="1.0" encoding="UTF-8"?> <resources> <string-array name="unrestricted_packages"> <item>com.facebook.katana</item> </string-array> </resources>
The com.facebook.katana is the application of facebook. So after adding the arrays.xml file to the /res/values/ folder, Assemble the ContactsProvider using the smali into an unsigned apk file.
Now , Since ICS , Android 4.0 , Google has disabled this provision of whitelisting applications natively , hence they have obfuscated certain fields from the database.
Add the column named
is_restricted
to the raw_contacts table inside contacts2.db ( stored in /data/data/com.android.providers.contacts/database/ )
If you have sqlite enabled ( along with busybox ) in your kernel you can use this command for altering the database and adding the necessary field by running it under ADB Shell:
sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db 'ALTER TABLE raw_contacts ADD COLUMN is_restricted VARCHAR';
After adding the column, all the facebook accounts added will be provided with Sync Prompt and they will appear under contacts.
经实测,按 Detailed
Explanation 方法成功实现。
直接上图:
修改前: 修改后:
相关文章推荐
- Android中VideoView播放视频不能充满屏幕以及视频上的view与视频不同步显示的问题
- Android R文件不能同步更新
- 同步Android手机联系人到iPhone手机通讯录
- Android 切换到后台歌词不能同步的问题
- Facebook在settings中不能同步解决方法
- Android自带浏览器不能同步书签到Google账户的问题
- Lync 2010 client 不能同步联系人
- Android 关于7.0权限相册不能选择 或者联系人不能选择的问题
- android开发中布局和代码块不能同步(可能findViewById找不到对应布局的id),这是因为安装的android stodio没有设置自动!
- android 编辑彩信时日历和联系人附件不能与其他附件共存
- android联系人同步相关随笔
- android SIM卡中联系人不能收藏的问题
- android保存USIM卡上的联系人时,提示“不能保存电话号码为空的联系人”的问题
- Titanium——Android同步手机本地联系人
- 索爱Android手机同步outlook电邮、日历、联系人、任务的方法--Moxier Pro
- android 5.0 编辑彩信时日历和联系人附件不能与其他附件共存
- android WebView loadData不能解析
- android获取联系人总结
- Android WebView 不能加载出全部网页
- android 取得系统联系人的头像