For the first question: Use a Content Observer attached to People storage:
getContentResolver().registerContentObserver (ContactsContract.Contacts.CONTENT_URI, true, new ContactOnserver());
Where:
class ContactOnserver extends ContentObserver {
public MyContentObserver() {
super(null);
}
@Override
public void onChange(boolean selfChange) {
// handle change here <----------------------------
}
}
This will keep you notified on Contact changes while your app is running.
As for your other question - how to get all changes made when app was NOT running - do something like this:
A. Before going down, have your app record the current time into a SharedPreferences field
B. After next load, query Contacts table for changes made after last-exit time.
I'm not providing any code sample here but I'm sure you will manage. Search the web for something like:
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);