14
Alexey Potapov Using of contact information & data model presentation in Android

Using of contact information & data model presentation in android - Алексей Потапов

Embed Size (px)

Citation preview

  • 1. Using of contact information & datamodel presentation in AndroidAlexey Potapov

2. Introduction to Contacts ProviderStructure Contacts Provider Access and DataConsistency Determination changes 3. Contacts Provider Structure ContactsContract.Contacts ContactsContract.RawContacts ContactsContract.Data 4. ContactsContract.RawContacts Sources of raw contacts datao Googleo Facebooko etc. Important raw contact columnso ACCOUNT_NAMEo ACCOUNT_TYPE 5. ContactsContract.Data Important raw contact columns Generic column nameso Data1 , , Data16 Type-specific column nameso CommonDataKinds.Photoo CommonDataKinds.Emailo etc. 6. ContactsContract.Contacts Neither applications norsync adapters are allowedto add contacts Contact is representationof RawContactsaggregation 7. Contacts Provider Metadata ContactsContract.RawContacts.DIRTY ContactsContract.RawContacts.VERSION ContactsContract.Data.DATA_VERSION ContactsContract.RawContacts.SOURCE_ID ContactsContract.RawContacts.DELETED 8. Contacts Provider Access and Data Consistency Contacts Aggregation Query contacts and data Batch modification 9. Contacts Aggregation ID=1JoinID=3ID=1 ID=1 ID=2ID=2 ID=2ID=3ID=1SeparateID=4ID=2 10. Query contacts and data Lookup Key vs. Contact IDUri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI,String.valueOf(mId));ContactsContract.Contacts.getLookupUri(mId, mLookupKey); Query entitiesAPI 11Uri.withAppendedPath(mContactUri,ContactsContract.Contacts.Entity.CONTENT_DIRECTORY); 11. Batch modification Yield pointso to prevent blocking the system Modification back referenceso to use result of a previous operation Optimistic concurrency controlo modification of database without having to lock the underlying repository 12. Determination changes ContentObservero onChange(boolean selfChange)o onChange(boolean selfChange, Uri uri) API 16 Check db modifications by queryo What we have?o What we want? 13. SELECT * FROM raw_contactsWHEREid||.||contact_id||.||versionNOT IN (?)SELECT * FROM dataWHEREid||.||data_versionNOT IN (?)? starred, etc. 14. Questions ? Alexey Potapov