SlideShare une entreprise Scribd logo
1  sur  14
Using contact information,
accounts sync and data submission
model in Android
Alexey Potapov
• Introduction to Contacts Provider
  Structure and Sync Accounts
• Data Modification, Contacts Provider
  Access and Data Consistency
• Determination changes
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 ACCOUNT_NAME
  o ACCOUNT_TYPE
ContactsContract.Data

• Important raw contact columns
• Generic column names
  o Data1 , … , Data16
• Type-specific column names
  o CommonDataKinds.Photo
  o CommonDataKinds.Email
  o etc.
ContactsContract.Contacts
• Neither applications nor
  sync adapters are allowed
  to add contacts
• Contact is representation
  of RawContacts
  aggregation
Contacts Provider Metadata

•   ContactsContract.RawContacts.DIRTY
•   ContactsContract.RawContacts.VERSION
•   ContactsContract.RawContacts.SOURCE_ID
•   ContactsContract.RawContacts.DELETED
•   ContactsContract.Data.DATA_VERSION
Contacts Provider Access and Data
           Consistency
• Contacts Aggregation
• Query contacts and data
• Batch modification
Contacts Aggregation
                               ID=1

              Join      ID=3

ID=1   ID=1
                               ID=2



ID=2   ID=2

                ID=3    ID=1

                                      Separate

                ID=4    ID=2
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);
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
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?
Short example
SELECT * FROM raw_contacts
    WHERE
        id||‘.’||contact_id||’.’
            ||version
    NOT IN (?)

SELECT * FROM data
    WHERE
        id||‘.’||data_version
    NOT IN (?)

? starred, etc.
Questions ?



      © Alexey Potapov

Contenu connexe

Similaire à Using of contact information in android

Using metadata: Who, how and why - Crossref LIVE Hannover
Using metadata: Who, how and why - Crossref LIVE HannoverUsing metadata: Who, how and why - Crossref LIVE Hannover
Using metadata: Who, how and why - Crossref LIVE HannoverCrossref
 
The Reach of Crossref metadata - Crossref LIVE South Africa
The Reach of Crossref metadata - Crossref LIVE South AfricaThe Reach of Crossref metadata - Crossref LIVE South Africa
The Reach of Crossref metadata - Crossref LIVE South AfricaCrossref
 
University Single Constituent View Repository ( SCoRe)
University Single Constituent View Repository ( SCoRe)University Single Constituent View Repository ( SCoRe)
University Single Constituent View Repository ( SCoRe)Hemant Verma
 
Data Management Best Practices
Data Management Best PracticesData Management Best Practices
Data Management Best PracticesChristopher Eaker
 
Systems of engagement
Systems of engagementSystems of engagement
Systems of engagementBryan Reinero
 
Recommendations at Zillow
Recommendations at ZillowRecommendations at Zillow
Recommendations at Zillownjstevens
 
PIDs and DOI registration with DataCite - IATUL Workshop 2013
PIDs and DOI registration with DataCite - IATUL Workshop 2013PIDs and DOI registration with DataCite - IATUL Workshop 2013
PIDs and DOI registration with DataCite - IATUL Workshop 2013Frauke Ziedorn
 
Common Data Model - A Business Database!
Common Data Model - A Business Database!Common Data Model - A Business Database!
Common Data Model - A Business Database!Pedro Azevedo
 
Getting started with looking up metadata
Getting started with looking up metadataGetting started with looking up metadata
Getting started with looking up metadataCrossref
 
Database management systems 3 - Data Modelling
Database management systems 3 - Data ModellingDatabase management systems 3 - Data Modelling
Database management systems 3 - Data ModellingNickkisha Farrell
 
Common Data Service – A Business Database!
Common Data Service – A Business Database!Common Data Service – A Business Database!
Common Data Service – A Business Database!Pedro Azevedo
 
DataONE Education Module 07: Metadata
DataONE Education Module 07: MetadataDataONE Education Module 07: Metadata
DataONE Education Module 07: MetadataDataONE
 
Eswc lsagrsv9-boris-110602060147-phpapp02
Eswc lsagrsv9-boris-110602060147-phpapp02Eswc lsagrsv9-boris-110602060147-phpapp02
Eswc lsagrsv9-boris-110602060147-phpapp02Victor Saquicela
 
Clients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om NextClients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om NextAntónio Monteiro
 

Similaire à Using of contact information in android (20)

array.pptx
array.pptxarray.pptx
array.pptx
 
Using metadata: Who, how and why - Crossref LIVE Hannover
Using metadata: Who, how and why - Crossref LIVE HannoverUsing metadata: Who, how and why - Crossref LIVE Hannover
Using metadata: Who, how and why - Crossref LIVE Hannover
 
The Reach of Crossref metadata - Crossref LIVE South Africa
The Reach of Crossref metadata - Crossref LIVE South AfricaThe Reach of Crossref metadata - Crossref LIVE South Africa
The Reach of Crossref metadata - Crossref LIVE South Africa
 
Data, data, everywhere? Not nearly enough!
Data, data, everywhere? Not nearly enough!Data, data, everywhere? Not nearly enough!
Data, data, everywhere? Not nearly enough!
 
University Single Constituent View Repository ( SCoRe)
University Single Constituent View Repository ( SCoRe)University Single Constituent View Repository ( SCoRe)
University Single Constituent View Repository ( SCoRe)
 
Data Management Best Practices
Data Management Best PracticesData Management Best Practices
Data Management Best Practices
 
Lecture7.pptx
Lecture7.pptxLecture7.pptx
Lecture7.pptx
 
Systems of engagement
Systems of engagementSystems of engagement
Systems of engagement
 
Automated Methods for Identity Resolution across Online Social Networks
Automated Methods for Identity Resolution across Online Social NetworksAutomated Methods for Identity Resolution across Online Social Networks
Automated Methods for Identity Resolution across Online Social Networks
 
Recommendations at Zillow
Recommendations at ZillowRecommendations at Zillow
Recommendations at Zillow
 
Intro to Data Management
Intro to Data ManagementIntro to Data Management
Intro to Data Management
 
Repairing Hidden Links in Linked Data
Repairing Hidden Links in Linked DataRepairing Hidden Links in Linked Data
Repairing Hidden Links in Linked Data
 
PIDs and DOI registration with DataCite - IATUL Workshop 2013
PIDs and DOI registration with DataCite - IATUL Workshop 2013PIDs and DOI registration with DataCite - IATUL Workshop 2013
PIDs and DOI registration with DataCite - IATUL Workshop 2013
 
Common Data Model - A Business Database!
Common Data Model - A Business Database!Common Data Model - A Business Database!
Common Data Model - A Business Database!
 
Getting started with looking up metadata
Getting started with looking up metadataGetting started with looking up metadata
Getting started with looking up metadata
 
Database management systems 3 - Data Modelling
Database management systems 3 - Data ModellingDatabase management systems 3 - Data Modelling
Database management systems 3 - Data Modelling
 
Common Data Service – A Business Database!
Common Data Service – A Business Database!Common Data Service – A Business Database!
Common Data Service – A Business Database!
 
DataONE Education Module 07: Metadata
DataONE Education Module 07: MetadataDataONE Education Module 07: Metadata
DataONE Education Module 07: Metadata
 
Eswc lsagrsv9-boris-110602060147-phpapp02
Eswc lsagrsv9-boris-110602060147-phpapp02Eswc lsagrsv9-boris-110602060147-phpapp02
Eswc lsagrsv9-boris-110602060147-phpapp02
 
Clients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om NextClients in control: building demand-driven systems with Om Next
Clients in control: building demand-driven systems with Om Next
 

Using of contact information in android

  • 1. Using contact information, accounts sync and data submission model in Android Alexey Potapov
  • 2. • Introduction to Contacts Provider Structure and Sync Accounts • Data Modification, Contacts Provider Access and Data Consistency • Determination changes
  • 3. Contacts Provider Structure • ContactsContract.Contacts • ContactsContract.RawContacts • ContactsContract.Data
  • 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. 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. ContactsContract.Contacts • Neither applications nor sync adapters are allowed to add contacts • Contact is representation of RawContacts aggregation
  • 7. Contacts Provider Metadata • ContactsContract.RawContacts.DIRTY • ContactsContract.RawContacts.VERSION • ContactsContract.RawContacts.SOURCE_ID • ContactsContract.RawContacts.DELETED • ContactsContract.Data.DATA_VERSION
  • 8. Contacts Provider Access and Data Consistency • Contacts Aggregation • Query contacts and data • Batch modification
  • 9. Contacts Aggregation ID=1 Join ID=3 ID=1 ID=1 ID=2 ID=2 ID=2 ID=3 ID=1 Separate ID=4 ID=2
  • 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. 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. 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. Short example SELECT * FROM raw_contacts WHERE id||‘.’||contact_id||’.’ ||version NOT IN (?) SELECT * FROM data WHERE id||‘.’||data_version NOT IN (?) ? starred, etc.
  • 14. Questions ? © Alexey Potapov