全部博文(413)
分类: LINUX
2010-04-09 17:05:05
ContactProvider를 사용하는 애플리케이션의 AndroidManifest.xml에 다음 추가
android:name="android.permission.READ_CONTACTS" />
android:name="android.permission.WRITE_CONTACTS" />
content://com.android.contacts/contacts
content://com.android.contacts/contacts/#
content://com.android.contacts/contacts/#/data
content://com.android.contacts/contacts/#/suggestions
content://com.android.contacts/contacts/#/suggestions/*
content://com.android.contacts/contacts/#/photo
content://com.android.contacts/contacts/filter/*
content://com.android.contacts/contacts/lookup/*
content://com.android.contacts/contacts/lookup/*/#
content://com.android.contacts/contacts/as_vcard/*
content://com.android.contacts/contacts/strequent/
content://com.android.contacts/contacts/strequent/filter/*
content://com.android.contacts/contacts/group/*
content://com.android.contacts/raw_contacts
content://com.android.contacts/raw_contacts/#
content://com.android.contacts/raw_contacts/#/data
content://com.android.contacts/raw_contacts/#/entity
content://com.android.contacts/raw_contact_entities
content://com.android.contacts/data
content://com.android.contacts/data/#
content://com.android.contacts/data/phones
content://com.android.contacts/data/phones/#
content://com.android.contacts/data/phones/filter
content://com.android.contacts/data/phones/filter/*
content://com.android.contacts/data/emails
content://com.android.contacts/data/emails/#
content://com.android.contacts/data/emails/lookup/*
content://com.android.contacts/data/emails/filter
content://com.android.contacts/data/emails/filter/*
content://com.android.contacts/data/postals
content://com.android.contacts/data/postals/#
content://com.android.contacts/groups"
content://com.android.contacts/groups/#
content://com.android.contacts/groups_summary
matcher.addURI(ContactsContract.AUTHORITY, SyncStateContentProviderHelper.PATH, SYNCSTATE);
matcher.addURI(ContactsContract.AUTHORITY, SyncStateContentProviderHelper.PATH + "/#", SYNCSTATE_ID);
content://com.android.contacts/phone_lookup/*
content://com.android.contacts/aggregation_exceptions
content://com.android.contacts/aggregation_exceptions/*
content://com.android.contacts/settings
content://com.android.contacts/status_updates
content://com.android.contacts/status_updates/#
matcher.addURI(ContactsContract.AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH_SUGGESTIONS);
matcher.addURI(ContactsContract.AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGESTIONS);
matcher.addURI(ContactsContract.AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/#", SEARCH_SHORTCUT);
content://com.android.contacts/live_folders/contacts
content://com.android.contacts/live_folders/contacts/*
content://com.android.contacts/live_folders/contacts_with_phones
content://com.android.contacts/live_folders/favorites
// Contacts URI matching table
content://contacts/extensions
content://contacts/extensions/#
content://contacts/groups
content://contacts/groups/#"
content://contacts/groups/name/*/members
content://contacts/groups/name/*/members/filter/*
content://contacts/groups/system_id/*/members
content://contacts/groups/system_id/*/members/filter/*
content://contacts/groupmembership
content://contacts/groupmembership/#
content://contacts/groupmembershipraw
content://contacts/people
content://contacts/people/strequent
content://contacts/people/strequent/filter/*
content://contacts/people/filter/*
content://contacts/people/with_phones_filter/*
content://contacts/people/with_email_or_im_filter/*
content://contacts/people/#
content://contacts/people/#/extensions
content://contacts/people/#/extensions/#
content://contacts/people/#/phones
content://contacts/people/#/phones_with_presence
content://contacts/people/#/photo
content://contacts/people/#/photo/data
content://contacts/people/#/phones/#
content://contacts/people/#/contact_methods
content://contacts/people/#/contact_methods_with_presence
content://contacts/people/#/contact_methods/#
content://contacts/people/#/organizations
content://contacts/people/#/organizations/#
content://contacts/people/#/groupmembership
content://contacts/people/#/groupmembership/#
content://contacts/people/raw
content://contacts/people/owner
content://contacts/people/#/update_contact_time
content://contacts/deleted_people
content://contacts/deleted_groups
content://contacts/phones
content://contacts/phones_with_presence
content://contacts/phones/filter/*
content://contacts/phones/filter_name/*
content://contacts/phones/mobile_filter_name/*
content://contacts/phones/#
content://contacts/photos
content://contacts/photos/#
content://contacts/contact_methods
content://contacts/contact_methods/email
content://contacts/contact_methods/email/*
content://contacts/contact_methods/#
content://contacts/contact_methods/with_presence
content://contacts/presence
content://contacts/presence/#
content://contacts/organizations
content://contacts/organizations/#
content://contacts/voice_dialer_timestamp
matcher.addURI(CONTACTS_AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH_SUGGESTIONS);
matcher.addURI(CONTACTS_AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGESTIONS);
matcher.addURI(CONTACTS_AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/#", SEARCH_SHORTCUT);
content://contacts/settings
content://contacts/live_folders/people
content://contacts/live_folders/people/*
content://contacts/live_folders/people_with_phones
content://contacts/live_folders/favorites
content://call_log/calls
content://call_log/calls/#
content://call_log/calls/filter/*
private static final HashMap<String, String> sCallsProjectionMap;
static {
// Calls projection map
sCallsProjectionMap = new HashMap<String, String>();
sCallsProjectionMap.put(Calls._ID, Calls._ID);
sCallsProjectionMap.put(Calls.NUMBER, Calls.NUMBER);
sCallsProjectionMap.put(Calls.DATE, Calls.DATE);
sCallsProjectionMap.put(Calls.DURATION, Calls.DURATION);
sCallsProjectionMap.put(Calls.TYPE, Calls.TYPE);
sCallsProjectionMap.put(Calls.NEW, Calls.NEW);
sCallsProjectionMap.put(Calls.CACHED_NAME, Calls.CACHED_NAME);
sCallsProjectionMap.put(Calls.CACHED_NUMBER_TYPE, Calls.CACHED_NUMBER_TYPE);
sCallsProjectionMap.put(Calls.CACHED_NUMBER_LABEL, Calls.CACHED_NUMBER_LABEL);
}
// One row per group of contacts corresponding to the same person
db.execSQL("CREATE TABLE " + Tables.CONTACTS + " (" +
BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
Contacts.DISPLAY_NAME + " TEXT," +
Contacts.PHOTO_ID + " INTEGER REFERENCES data(_id)," +
Contacts.CUSTOM_RINGTONE + " TEXT," +
Contacts.SEND_TO_VOICEMAIL + " INTEGER NOT NULL DEFAULT 0," +
Contacts.TIMES_CONTACTED + " INTEGER NOT NULL DEFAULT 0," +
Contacts.LAST_TIME_CONTACTED + " INTEGER," +
Contacts.STARRED + " INTEGER NOT NULL DEFAULT 0," +
Contacts.IN_VISIBLE_GROUP + " INTEGER NOT NULL DEFAULT 1," +
Contacts.HAS_PHONE_NUMBER + " INTEGER NOT NULL DEFAULT 0," +
Contacts.LOOKUP_KEY + " TEXT," +
ContactsColumns.LAST_STATUS_UPDATE_ID + " INTEGER REFERENCES data(_id)," +
ContactsColumns.SINGLE_IS_RESTRICTED + " INTEGER NOT NULL DEFAULT 0" +
");");
// Contacts table
db.execSQL("CREATE TABLE " + Tables.RAW_CONTACTS + " (" +
RawContacts._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
RawContacts.IS_RESTRICTED + " INTEGER DEFAULT 0," +
RawContacts.ACCOUNT_NAME + " STRING DEFAULT NULL, " +
RawContacts.ACCOUNT_TYPE + " STRING DEFAULT NULL, " +
RawContacts.SOURCE_ID + " TEXT," +
RawContacts.VERSION + " INTEGER NOT NULL DEFAULT 1," +
RawContacts.DIRTY + " INTEGER NOT NULL DEFAULT 0," +
RawContacts.DELETED + " INTEGER NOT NULL DEFAULT 0," +
RawContacts.CONTACT_ID + " INTEGER REFERENCES contacts(_id)," +
RawContacts.AGGREGATION_MODE + " INTEGER NOT NULL DEFAULT " +
RawContacts.AGGREGATION_MODE_DEFAULT + "," +
RawContactsColumns.AGGREGATION_NEEDED + " INTEGER NOT NULL DEFAULT 1," +
RawContacts.CUSTOM_RINGTONE + " TEXT," +
RawContacts.SEND_TO_VOICEMAIL + " INTEGER NOT NULL DEFAULT 0," +
RawContacts.TIMES_CONTACTED + " INTEGER NOT NULL DEFAULT 0," +
RawContacts.LAST_TIME_CONTACTED + " INTEGER," +
RawContacts.STARRED + " INTEGER NOT NULL DEFAULT 0," +
RawContactsColumns.DISPLAY_NAME + " TEXT," +
RawContactsColumns.DISPLAY_NAME_SOURCE + " INTEGER NOT NULL DEFAULT " + DisplayNameSources.UNDEFINED + "," +
RawContacts.SYNC1 + " TEXT, " +
RawContacts.SYNC2 + " TEXT, " +
RawContacts.SYNC3 + " TEXT, " +
RawContacts.SYNC4 + " TEXT " +
");");
// Public generic data table
db.execSQL("CREATE TABLE " + Tables.DATA + " (" +
Data._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
DataColumns.PACKAGE_ID + " INTEGER REFERENCES package(_id)," +
DataColumns.MIMETYPE_ID + " INTEGER REFERENCES mimetype(_id) NOT NULL," +
Data.RAW_CONTACT_ID + " INTEGER REFERENCES raw_contacts(_id) NOT NULL," +
Data.IS_PRIMARY + " INTEGER NOT NULL DEFAULT 0," +
Data.IS_SUPER_PRIMARY + " INTEGER NOT NULL DEFAULT 0," +
Data.DATA_VERSION + " INTEGER NOT NULL DEFAULT 0," +
Data.DATA1 + " TEXT," +
Data.DATA2 + " TEXT," +
Data.DATA3 + " TEXT," +
Data.DATA4 + " TEXT," +
Data.DATA5 + " TEXT," +
Data.DATA6 + " TEXT," +
Data.DATA7 + " TEXT," +
Data.DATA8 + " TEXT," +
Data.DATA9 + " TEXT," +
Data.DATA10 + " TEXT," +
Data.DATA11 + " TEXT," +
Data.DATA12 + " TEXT," +
Data.DATA13 + " TEXT," +
Data.DATA14 + " TEXT," +
Data.DATA15 + " TEXT," +
Data.SYNC1 + " TEXT, " +
Data.SYNC2 + " TEXT, " +
Data.SYNC3 + " TEXT, " +
Data.SYNC4 + " TEXT " +
");");
// Groups table
db.execSQL("CREATE TABLE " + Tables.GROUPS + " (" +
Groups._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
GroupsColumns.PACKAGE_ID + " INTEGER REFERENCES package(_id)," +
Groups.ACCOUNT_NAME + " STRING DEFAULT NULL, " +
Groups.ACCOUNT_TYPE + " STRING DEFAULT NULL, " +
Groups.SOURCE_ID + " TEXT," +
Groups.VERSION + " INTEGER NOT NULL DEFAULT 1," +
Groups.DIRTY + " INTEGER NOT NULL DEFAULT 0," +
Groups.TITLE + " TEXT," +
Groups.TITLE_RES + " INTEGER," +
Groups.NOTES + " TEXT," +
Groups.SYSTEM_ID + " TEXT," +
Groups.DELETED + " INTEGER NOT NULL DEFAULT 0," +
Groups.GROUP_VISIBLE + " INTEGER NOT NULL DEFAULT 0," +
Groups.SHOULD_SYNC + " INTEGER NOT NULL DEFAULT 1," +
Groups.SYNC1 + " TEXT, " +
Groups.SYNC2 + " TEXT, " +
Groups.SYNC3 + " TEXT, " +
Groups.SYNC4 + " TEXT " +
");");
// The table for recent calls is here so we can do table joins
// on people, phones, and calls all in one place.
db.execSQL("CREATE TABLE " + Tables.CALLS + " (" +
Calls._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
Calls.NUMBER + " TEXT," +
Calls.DATE + " INTEGER," +
Calls.DURATION + " INTEGER," +
Calls.TYPE + " INTEGER," +
Calls.NEW + " INTEGER," +
Calls.CACHED_NAME + " TEXT," +
Calls.CACHED_NUMBER_TYPE + " INTEGER," +
Calls.CACHED_NUMBER_LABEL + " TEXT" +
");");
// Activities table
db.execSQL("CREATE TABLE " + Tables.ACTIVITIES + " (" +
Activities._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
ActivitiesColumns.PACKAGE_ID + " INTEGER REFERENCES package(_id)," +
ActivitiesColumns.MIMETYPE_ID + " INTEGER REFERENCES mimetype(_id) NOT NULL," +
Activities.RAW_ID + " TEXT," +
Activities.IN_REPLY_TO + " TEXT," +
Activities.AUTHOR_CONTACT_ID + " INTEGER REFERENCES raw_contacts(_id)," +
Activities.TARGET_CONTACT_ID + " INTEGER REFERENCES raw_contacts(_id)," +
Activities.PUBLISHED + " INTEGER NOT NULL," +
Activities.THREAD_PUBLISHED + " INTEGER NOT NULL," +
Activities.TITLE + " TEXT NOT NULL," +
Activities.SUMMARY + " TEXT," +
Activities.LINK + " TEXT, " +
Activities.THUMBNAIL + " BLOB" +
");");
CalendarProvider를 사용할 때 AndroidManifest.xml에 다음을 등록
android:name="android.permission.READ_CALENDAR" />
android:name="android.permission.WRITE_CALENDAR" />
content://calendar/instances/when/*/*
content://calendar/instances/whenbyday/*/*
content://calendar/events
content://calendar/events/#
content://calendar/calendars
content://calendar/calendars/#
content://calendar/deleted_events
content://calendar/attendees
content://calendar/attendees/#
content://calendar/reminders
content://calendar/reminders/#
content://calendar/extendedproperties
content://calendar/extendedproperties/#
content://calendar/calendar_alerts
content://calendar/calendar_alerts/#
content://calendar/calendar_alerts/by_instance
content://calendar/busybits/when/*/*
CREATE TABLE Calendars (
_id INTEGER PRIMARY KEY,
_sync_account TEXT,
_sync_account_type TEXT
_sync_id TEXT
_sync_version TEXT
_sync_time TEXT, -- UTC
_sync_local_id INTEGER,
_sync_dirty INTEGER,
_sync_mark INTEGER, -- Used to filter out new rows
url TEXT,
name TEXT,
displayName TEXT,
hidden INTEGER NOT NULL DEFAULT 0,
color INTEGER,
access_level INTEGER,
selected INTEGER NOT NULL DEFAULT 1,
sync_events INTEGER NOT NULL DEFAULT 0,
location TEXT,
timezone TEXT,
ownerAccount TEXT
);
CREATE TABLE Events (
_id INTEGER PRIMARY KEY,
_sync_account TEXT,
_sync_account_type TEXT,
_sync_id TEXT,
_sync_version TEXT,
_sync_time TEXT,
_sync_local_id INTEGER,
_sync_dirty INTEGER,
_sync_mark INTEGER, -- To filter out new rows
calendar_id INTEGER NOT NULL,
htmlUri TEXT,
title TEXT,
eventLocation TEXT,
description TEXT,
eventStatus INTEGER,
selfAttendeeStatus INTEGER NOT NULL DEFAULT 0,
commentsUri TEXT,
dtstart INTEGER, -- millis since epoch
dtend INTEGER, -- millis since epoch
eventTimezone TEXT, -- timezone for event
duration TEXT,
allDay INTEGER NOT NULL DEFAULT 0,
visibility INTEGER NOT NULL DEFAULT 0,
transparency INTEGER NOT NULL DEFAULT 0,
hasAlarm INTEGER NOT NULL DEFAULT 0,
hasExtendedProperties INTEGER NOT NULL DEFAULT 0,
rrule TEXT,
rdate TEXT,
exrule TEXT,
exdate TEXT,
originalEvent TEXT, -- _sync_id of recurring event
originalInstanceTime INTEGER, -- millis since epoch
originalAllDay INTEGER,
lastDate INTEGER, -- millis since epoch
hasAttendeeData INTEGER NOT NULL DEFAULT 0,
guestsCanModify INTEGER NOT NULL DEFAULT 0,
guestsCanInviteOthers INTEGER NOT NULL DEFAULT 1,
guestsCanSeeGuests INTEGER NOT NULL DEFAULT 1,
organizer STRING
);
CREATE TABLE EventsRawTimes (
_id INTEGER PRIMARY KEY,
event_id INTEGER NOT NULL,
dtstart2445 TEXT,
dtend2445 TEXT,
originalInstanceTime2445 TEXT,
lastDate2445 TEXT,
UNIQUE (event_id)
);
CREATE TABLE DeletedEvents (
_sync_id TEXT,
_sync_version TEXT,
_sync_account TEXT,
_sync_account_type TEXT,
_sync_local_id INTEGER, -- Used while syncing,
_sync_mark INTEGER, -- To filter out new rows
calendar_id INTEGER
);
CREATE TABLE Instances (
_id INTEGER PRIMARY KEY,
event_id INTEGER,
begin INTEGER, -- UTC millis
end INTEGER, -- UTC millis
startDay INTEGER, -- Julian start day
endDay INTEGER, -- Julian end day
startMinute INTEGER, -- minutes from midnight
endMinute INTEGER, -- minutes from midnight
UNIQUE (event_id, begin, end)
);
CREATE TABLE CalendarMetaData (
_id INTEGER PRIMARY KEY,
localTimezone TEXT,
minInstance INTEGER, -- UTC millis
maxInstance INTEGER, -- UTC millis
minBusyBits INTEGER, -- UTC millis
maxBusyBits INTEGER -- UTC millis
);
CREATE TABLE BusyBits(
day INTEGER PRIMARY KEY, -- the Julian day
busyBits INTEGER, -- 24 bits for 60-minute intervals
allDayCount INTEGER -- number of all-day events
);
CREATE TABLE Attendees (
_id INTEGER PRIMARY KEY,
event_id INTEGER,
attendeeName TEXT,
attendeeEmail TEXT,
attendeeStatus INTEGER,
attendeeRelationship INTEGER,
attendeeType INTEGER
);
CREATE TABLE Reminders (
_id INTEGER PRIMARY KEY,
event_id INTEGER,
minutes INTEGER,
method INTEGER NOT NULL DEFAULT Reminders.METHOD_DEFAULT
);
CREATE TABLE CalendarAlerts (
_id INTEGER PRIMARY KEY,
event_id INTEGER,
begin INTEGER NOT NULL, -- UTC millis
end INTEGER NOT NULL, -- UTC millis
alarmTime INTEGER NOT NULL, -- UTC millis
creationTime INTEGER NOT NULL, -- UTC millis
receivedTime INTEGER NOT NULL, -- UTC millis
notifyTime INTEGER NOT NULL, -- UTC millis
state INTEGER NOT NULL
minutes INTEGER,
UNIQUE (alarmTime, begin, event_id)
);
CREATE TABLE ExtendedProperties (
_id INTEGER PRIMARY KEY,
event_id INTEGER,
name TEXT,
value TEXT
);
content://media/*/images/media
content://media/*/images/media/#
content://media/*/images/thumbnails
content://media/*/images/thumbnails/#
content://media/*/audio/media
content://media/*/audio/media/#;
content://media/*/audio/media/#/genres
content://media/*/audio/media/#/genres/#
content://media/*/audio/media/#/playlists
content://media/*/audio/media/#/playlists/#
content://media/*/audio/genres
content://media/*/audio/genres/#
content://media/*/audio/genres/#/members
content://media/*/audio/genres/#/members/#
content://media/*/audio/playlists
content://media/*/audio/playlists/#
content://media/*/audio/playlists/#/members
content://media/*/audio/playlists/#/members/#
content://media/*/audio/artists
content://media/*/audio/artists/#
content://media/*/audio/artists/#/albums
content://media/*/audio/albums
content://media/*/audio/albums/#
content://media/*/audio/albumart
content://media/*/audio/albumart/#
content://media/*/audio/media/#/albumart
content://media/*/video/media
content://media/*/video/media/#
content://media/*/video/thumbnails
content://media/*/video/thumbnails/#
content://media/*/media_scanner
content://media/*
content://media"
/**
* @deprecated use the 'basic' or 'fancy' search Uris instead
*/
content://media/*/audio/" + SearchManager.SUGGEST_URI_PATH_QUERY, AUDIO_SEARCH_LEGACY);
content://media/*/audio/" + SearchManager.SUGGEST_URI_PATH_QUERY + "/*", AUDIO_SEARCH_LEGACY);
// used for search suggestions
content://media/*/audio/search/" + SearchManager.SUGGEST_URI_PATH_QUERY,
AUDIO_SEARCH_BASIC);
content://media/*/audio/search/" + SearchManager.SUGGEST_URI_PATH_QUERY + "/*", AUDIO_SEARCH_BASIC);
// used by the music app's search activity
content://media/*/audio/search/fancy
content://media/*/audio/search/fancy/*
content://sms
content://sms/#
content://sms/inbox
content://sms/inbox/#
content://sms/sent
content://sms/sent/#
content://sms/draft
content://sms/draft/#
content://sms/outbox
content://sms/outbox/#
content://sms/undelivered
content://sms/failed
content://sms/failed/#
content://sms/queued
content://sms/conversations
content://sms/conversations/*
content://sms/raw
content://sms/attachments
content://sms/attachments/#
content://sms/threadID
content://sms/threadID/*
content://sms/status/#
content://sms/sr_pending
content://sms/icc
content://sms/icc/#
//we keep these for not breaking old applications
content://sms/sim
content://sms/sim/#
content://mms
content://mms/#
content://mms/inbox
content://mms/inbox/#
content://mms/sent
content://mms/sent/#
content://mms/drafts
content://mms/drafts/#
content://mms/outbox
content://mms/outbox/#
content://mms/part
content://mms/#/part
content://mms/part/#
content://mms/#/addr
content://mms/rate
content://mms/report-status/#
content://mms/report-request/#
content://mms/drm
content://mms/drm/#
content://mms/threads
content://mms/scrapSpace
content://telephony/carriers
content://telephony/carriers/current
content://telephony/carriers/#
content://telephony/carriers/restore
content://telephony/carriers/preferapn
content://mms-sms/conversations
content://mms-sms/complete-conversations
// In these patterns, "#" is the thread ID.
content://mms-sms/conversations/#
content://mms-sms/conversations/#/recipients
content://mms-sms/conversations/#/subject
// URI for deleting obsolete threads.
content://mms-sms/conversations/obsolete", URI_OBSOLETE_THREADS);
content://mms-sms/messages/byphone/*
// In this pattern, two query parameter names are expected:
// "subject" and "recipient." Multiple "recipient" parameters
// may be present.
content://mms-sms/threadID
// Use this pattern to query the canonical address by given ID.
content://mms-sms/canonical-address/#
// Use this pattern to query all canonical addresses.
content://mms-sms/canonical-addresses
content://mms-sms/search
// In this pattern, two query parameters may be supplied:
// "protocol" and "message." For example:
// content://mms-sms/pending?
// -> Return all pending messages;
// content://mms-sms/pending?protocol=sms
// -> Only return pending SMs;
// content://mms-sms/pending?protocol=mms&message=1
// -> Return the the pending MM which ID equals '1'.
//
content://mms-sms/pending
// Use this pattern to get a list of undelivered messages.
content://mms-sms/undelivered
// Use this pattern to see what delivery status reports (for
// both MMS and SMS) have not been delivered to the user.
content://mms-sms/notifications
content://mms-sms/draft
content://mms-sms/locked
content://mms-sms/locked/#