Contact Detail syncing between people app and my app - android

I am involved in a project which has the functionality like whatsapp does for contacts.My app have to get the contact from phone(ie Peoples app) and sync it to server to find the users who are all already involved in my app.If a user not involved already i need to place a invite button.
For sync there is no problem i implemented a sync adapter,I have to get the updates like new phone no added or name changed in the contacts of people app.
I think VERSION and CONTACT_LAST_UPDATED_TIMESTAMP fields are not exactly what i need.Because they may be updated when other details in the
are changed.
I need to monitor the contacts change when my app starts,if there any changes in contacts i need to get that contact details and send it to server to know his status.Is running a service with content observer
will work for this case.
If it works how can i get the updated contact details.
Could someone help me?

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.

Contact sync adapter in android

I want to use sync adapter in my application to sync the native and third party contacts (except FB) with server. ( Only client to server one way sync)
I have two doubts here -
1) If there are multiple sync adapters in the device and If dirty bit is already cleared by another sync adapter , would my sync adapter be able to detect the contacts change/update immediately.
2) I have used
ContentResolver.setIsSyncable(account, ContactsContract.AUTHORITY, 1);
ContentResolver.setSyncAutomatically(account, ContactsContract.AUTHORITY, true);
to sync the contacts with server .
It does start the sync in every 30 seconds .
But I want it to get notified immediately when ever contacts are added Or Deleted or Updated to start perfromSync operation.
Do I need to use observer too ?
In order to see changes to the contacts you will have to register an observer with the ContentResolver. The sync API is not intended to watch for every change, it is intended to be a background API that Android runs periodically automatically for you, so that it can batch operations and use the network more efficiently, not run when network is disabled, etc...
The dirty bit is used on a per account basis. In general the sync is designed to have an "owning" account per contact, and is not designed for exporting all the contacts from the device to a particular service. There is an aggregation process that handles joining contacts from multiple accounts into one "Contact" as seen by the user. See:
http://developer.android.com/reference/android/provider/ContactsContract.RawContacts.html
For more information on how this works.
If you intend to export all contacts on the device to your service you will need to walk the contacts and insert a raw contact for your service. You will then also want to watch the ContentResolver with an observer to see when the user adds a new contact on some service or periodically walk the table looking for contacts you have not yet exported.
use the version bit. If any contact edited
It automatically increased by 1.
so you create local database for compare previous version to current version. If any changes happen you trigger the update query.
for more information visit here.
This version helps for my sync updates. So I share this answer for all.

android check if a contact installed an app android (like whatsapp)

I want to let my app scan the users contactlist , and display the name of the contacts who also installed the app.
I have no idea where to begin with this . so if someone could help me getting started , that would be apreciated.
grtz
You will need to research ContentResolver because you will have to query the database containing the contacts. To do these queries, you will need the URI and column/header names for contacts db which can be found in the Contacts class.
You will also need users to register that they have your app on your own servers and the registration will need a piece of information about the user that other users would have in their contacts (the users phone number, email address, etc).
You will then need to query a few users at a time from the users contacts for this piece of information (using the ContentResolver and Contacts class), pass it to your server (as text) where it will check if they are registered, then send a message back to initial user (and possibly the match) that you found a match.
That's where you should start, and end :)
Note, you will need these permissions in the Manifest file:
android.permission.INTERNET
android.permission.READ_CONTACTS
First of all, welcome to StackOverflow. StackOverflow is for programming questions. As is such, a post asking for help should always provide a description of what you have already tried. If you haven't tried anything yet, I highly encourage you to try something, and post when you encounter a problem.
As your question stands now, we don't know what the problem is. Are you having problems scanning a contact list? Or are you having problems trying to figure out if another user has installed the app?
That being said, you will have to maintain a database for your app containing a list of people who have installed your app. When your app is launched on one device, do whatever you need to do to register the user in your database. Due to the nature of a "contact," one person's phone may only have their phone number, email address, or even just a name. This is of course something you will have to deal with in your implementation.

View / Edit Contact on Android

I am trying to add these functionality in my Android app:
1) Get A list of suggested contacts from a Web Service and Display them in a list view
- This I have implemented and working fine
2) When User selects any of these contacts I want to present them in Native Contact View. My fried who is iPhone developer was able to do this with help of ABPerson class which provides feature to display the contact in native contact view page without adding the contact to contact list. I am not able to find any such API in Andoid. Please suggest.
3) When User want to edit any contact in the above list, I am able to present Edit Contact activity from native Phone Book app. This is working fine, but I am not able to remove the Done and Revert button. Unfortunately due to this, if user click on Done that contact is added to phone, however, what I want to do here is that, user can modify the data and I will keep it in the memory till the export process starts. During the export process I will insert these records in the Phone Book.
Please suggest me how can I do this.
I would advise you look over the BusinessCard sample and ContactManager sample posted on the Android developer site.
Reading carefully through both of these is what helped me understand exactly what's going on in the contacts API.

Cant delete more than 200 contacts in HTC HERO

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?

Categories

Resources