Your SlideShare is downloading. ×
0
Using contact information,accounts sync and data submissionmodel in AndroidAlexey Potapov
• Introduction to Contacts Provider  Structure and Sync Accounts• Data Modification, Contacts Provider  Access and Data Co...
Contacts Provider Structure• ContactsContract.Contacts• ContactsContract.RawContacts• ContactsContract.Data
ContactsContract.RawContacts• Sources of raw contacts data  o Google  o Facebook  o etc.• Important raw contact columns  o...
ContactsContract.Data• Important raw contact columns• Generic column names  o Data1 , … , Data16• Type-specific column nam...
ContactsContract.Contacts• Neither applications nor  sync adapters are allowed  to add contacts• Contact is representation...
Contacts Provider Metadata•   ContactsContract.RawContacts.DIRTY•   ContactsContract.RawContacts.VERSION•   ContactsContra...
Contacts Provider Access and Data           Consistency• Contacts Aggregation• Query contacts and data• Batch modification
Contacts Aggregation                               ID=1              Join      ID=3ID=1   ID=1                            ...
Query contacts and data• Lookup Key vs. Contact ID  Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI,  String.va...
Batch modification• Yield points  o to prevent blocking the system• Modification back references  o to use result of a pre...
Determination changes• ContentObserver  o onChange(boolean selfChange)  o onChange(boolean selfChange, Uri uri)   API 16• ...
Short exampleSELECT * FROM raw_contacts    WHERE        id||‘.’||contact_id||’.’            ||version    NOT IN (?)SELECT ...
Questions ?      © Alexey Potapov
Upcoming SlideShare
Loading in...5
×

Using of contact information in android

907

Published on

Using contact information, accounts sync and data submission model in Android

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
907
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Using of contact information in android"

  1. 1. Using contact information,accounts sync and data submissionmodel in AndroidAlexey Potapov
  2. 2. • Introduction to Contacts Provider Structure and Sync Accounts• Data Modification, Contacts Provider Access and Data Consistency• Determination changes
  3. 3. Contacts Provider Structure• ContactsContract.Contacts• ContactsContract.RawContacts• ContactsContract.Data
  4. 4. ContactsContract.RawContacts• Sources of raw contacts data o Google o Facebook o etc.• Important raw contact columns o ACCOUNT_NAME o ACCOUNT_TYPE
  5. 5. ContactsContract.Data• Important raw contact columns• Generic column names o Data1 , … , Data16• Type-specific column names o CommonDataKinds.Photo o CommonDataKinds.Email o etc.
  6. 6. ContactsContract.Contacts• Neither applications nor sync adapters are allowed to add contacts• Contact is representation of RawContacts aggregation
  7. 7. Contacts Provider Metadata• ContactsContract.RawContacts.DIRTY• ContactsContract.RawContacts.VERSION• ContactsContract.RawContacts.SOURCE_ID• ContactsContract.RawContacts.DELETED• ContactsContract.Data.DATA_VERSION
  8. 8. Contacts Provider Access and Data Consistency• Contacts Aggregation• Query contacts and data• Batch modification
  9. 9. Contacts Aggregation ID=1 Join ID=3ID=1 ID=1 ID=2ID=2 ID=2 ID=3 ID=1 Separate ID=4 ID=2
  10. 10. Query contacts and data• Lookup Key vs. Contact ID Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(mId)); ContactsContract.Contacts.getLookupUri(mId, mLookupKey);• Query entities API 11 Uri.withAppendedPath(mContactUri, ContactsContract.Contacts.Entity.CONTENT_DIRECTORY);
  11. 11. Batch modification• Yield points o to prevent blocking the system• Modification back references o to use result of a previous operation• Optimistic concurrency control o modification of database without having to lock the underlying repository
  12. 12. Determination changes• ContentObserver o onChange(boolean selfChange) o onChange(boolean selfChange, Uri uri) API 16• Check db modifications by query o What we have? o What we want?
  13. 13. Short exampleSELECT * FROM raw_contacts WHERE id||‘.’||contact_id||’.’ ||version NOT IN (?)SELECT * FROM data WHERE id||‘.’||data_version NOT IN (?)? starred, etc.
  14. 14. Questions ? © Alexey Potapov
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×