Cant delete more than 200 contacts in HTC HERO - android

I'm working on security application which will copy all contacts to some other database and delete all contacts from phonebook.
I'm testing this on android HTC HERO.
I'm successful to delete contacts from phonebook and create new contact info database,
Till 200 it is working, but after 200 contacts its not working properly.
After tht application starts throwing error.
There is one Sync with Google Option in Menu>Setting>Data Sync, I think that is creating problem.
There is notification that "Too many contacts deleted"
n if i click tht there will b a dialog with title "Delete Limit exceeded".
Is there anything i can do to stop syncronization or any other ideas by which i can achieve
required output?
Please Help me on this

Google Sync is a bit picky - it hates it when there are too many things going on. The calendar has the same problem. I doubt that you want to turn syncing off (the user may not appreciate it either if you turn off a core functionality). What's your goal? Do you want the deletion of contacts to be synced with gmail.com or not?
At this point, your only options as far as I can tell would be to throttle your app so it doesn't delete more than 200 records within a certain timeframe. Alternatively, you could use gdata to modify the contacts, but that's a really roundabout way and probably not suitable for your needs.
Do you delete and then re-create the contacts? Is there any way for you to recycle existing contacts instead of deleting them and then starting from scratch?

Related

Android contacts sync in background

I want to show the contacts whoever using my app. I know this is an old one but nothing satisfies me. I'm already using the method that gets all the contacts from phone and send to server and checking the available contacts who all are
using my app then return to my app.
Finally, it will save into the local database. But the problem is when adding new contact we have to sync again. For that time it will take more time and other functionality may become slow.
What I need is when I open the app at first time it should sync all the contacts and then it should monitor the changes like add, delete and update of the contacts then only it should check the changed contact.
I refers this blog, but there is no proper code. So many files are missed. How can i sync contacts?
finally,I have done with this library.

Control default contact list and messages app

Is there a way I can control what contact list and messages show? I want to make an app that if enabled will hide certain contacts or messages from certain people. I am not sure of this is doable
Please let me know if this can be done programmatically. Please note that I am referring to the default contact/messages APP that comes with android and I want to be able to control what it shows from my app
Thank you
Please note that I am referring to the default contact/messages APP that comes with android and I want to be able to control what it shows from my app
Fortunately, this is not possible, except by modifying the actual data, as noted in a comment on your question. You cannot hack into other apps like some script kiddie.
Note that, due to synchronization, deleting contacts may wind up deleting them from an upstream data source. The user may not appreciate this.
You are welcome to build your own contact app that maintains its own filtered list of contacts.

How to update Contact without removing already stored data?

I'm trying to do a sync adapter to sync my contacts with an webstorage.
When I ask this server for any contactupdates on the server-side I get a list of all the new informations added/changed. To update them I'm using the preferred method described here
My problem is that when I make a ContactOperations.newUpdate() and feed it with all the new/changed informations I got from the webserver and then apply it to the ContactsContract.AUTHORITY all the informations already stored on the phone are erased?!?
I make an example to make thinks clear:
I have an contact saved on my phone named: John 'Dady' Doe. Now the SyncAdapter ist invoked by the system, he ask the server for any contactchanges and the server says, that the familyname of this contact now is "Jones". With that information I construct a new ContactProviderOperation.newUpdate() and feed it via .withValue() and apply it. But what Android really does is: It flushes all othere columns and now my contact is named "Jones" (givenName and middleName missing -.-).
Is there any way to prevent Android from doing so? Can I pass any parameter like the CALLER_IS_SYNCADAPTER? Or do I need to make my own workaround (hopefully not), like reading the data record first, apply the updates and then apply it to the ContactsContract.AUTHORITY?
Any hint is really appreciated!
/edit: I did further studies by looking at the SyncAdapterExample, especially at the "update a contact"-part, but what I saw kinda shocked me: Google actually does read the contact first, then apply the updates from the server and reapply it to the ContactsContract.AUTHORITY. But they only handle first- and lastname, one email and two phones (normal and mobile). In my case I wan't to handle ALL contactinformations, so it's not feasible to do such a workaround, except there is no other way, which I hope not. Hopefully someone can head me in the right direction for this.
Totally my fault :/
Android is doing everything right, I just failed as hard as this guy ...

Two way sync adapter in Android

I have gone through a number of links and have spend a huge amount of time over this. Can someone please let me know the simplest approach to implement the Sync Adapter in Android which is 2 way. I mean the changes made on the remote database get reflected on the Android Device and the changes from the device should get updated on the server too.
Also, how to edit the contacts from the default contacts app editor??

Contacts backup and sync application

I am working on a contacts backup and sync.
The target is to send all details of all contacts to a server (custom protocol defined) as a backup.
During initial launch of application, all the contacts will be queued and sent to the server.
And after that, a background service will be running all time which will listen to new contact addition/ contact update, and this new/updated contact will be sent to server by the background service.
I am using RawContactsEntity for fetching the records.
I tried using ContentObserver on RawContacts/Data tables to get notification of contact addition or contact-change. But, AFAIK, the ContentObserver gives notification (onChange()) of changed data in table as a whole and not ID of individual record.
Now my problem is, how to get the exact id's of changed/new records?
I thought of creating a backup-table to compare with native contacts table and get the changed records. But as the number of contacts increase, the performance will decease drastically and this will hamper the battery life too.
Can you suggest me, The best way for achieving this contacts backup operation from performance and memory usage point of view?
Is there any other way for contacts sync operation?
It would be very helpful if anyone can share examples which can help me in this.
If the contacts are stored within your account(AccountManger), Android will mark the dirty flag in raw contacts. If it is not your account then you can not trust the dirty flag as the accounts sync adapter might have updated the contact to the server and reset the dirty flag. Your only option is to either re-upload the full contacts(simple and easy to code) or keep track of the version column in RawContacts and check which one has changed. It is actually not recommended to copy and upload contacts from other accounts as the corresponding sync adapter will anyways maintain a backup of those. Like Google will have a copy of Google contacts on their server.

Categories

Resources