-
Notifications
You must be signed in to change notification settings - Fork 89
Android providers
Ran Ben Aharon edited this page Aug 19, 2015
·
2 revisions
dependencies {
compile 'me.everything:providers-android:1.0.1'
}
- Calendars
- Events
- Instances
- Reminders
- Attendees
- Contacts
- Call logs
- Telephony
- SMS
- MMS
- Conversations
- Threads
- Carriers
- Media (external + internal)
- Files
- Images
- Videos
- Audios
- Albums
- Artists
- Genres
- Playlists
- Browser
- Bookmarks
- Searches
- Dictionary
CalendarProvider calendarProvider = new CalendarProvider(context);
Required permission:
<uses-permission android:name="android.permission.READ_CALENDAR"/>
Calendar
-
calendarProvider.getCalendars();
- Get all calendars -
calendarProvider.getCalendar(calendarId);
- Get calendar by id -
calendarProvider.update(calendar);
- Update calendar
Event
-
calendarProvider.getEvents(calendarId);
- Get all events by calendar id -
calendarProvider.getEvent(eventId);
- Get event by event id -
calendarProvider.update(event);
- Update event
Instance
-
calendarProvider.getInstances(begin, end);
- Get all instances by date range -
calendarProvider.getInstances(eventId, begin, end);
- Get all instances by date range of event -
calendarProvider.update(instance);
- Update instance
Attendee
-
calendarProvider.getAttendees(eventId);
- Get all attendees of event -
calendarProvider.update(instance);
- Update instance
Reminder
-
calendarProvider.getReminders(eventId);
- Get all reminders of event -
calendarProvider.update(reminder);
- Update reminder
ContactsProvider contactsProvider = new ContactsProvider(context);
Required permission:
<uses-permission android:name="android.permission.READ_CONTACTS"/>
Contact
-
contactsProvider.getContacts();
- Get all contacts
CallsProvider callsProvider = new CallsProvider(context);
Required permission:
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
Call
-
callsProvider.getCalls();
- Get all calls
TelephonyProvider telephonyProvider = new TelephonyProvider(context);
Required permission:
<uses-permission android:name="android.permission.READ_SMS"/>
Sms
-
telephonyProvider.getSms(filter);
- Get all sms(es) by filtering (inbox, sent, ...)
Mms
-
telephonyProvider.getMms(filter);
- Get all mms(es) by filtering (inbox, sent, ...)
Conversation
-
telephonyProvider.getConversations();
- Get all conversations
Thread
-
telephonyProvider.getThreads();
- Get all threads
Carrier
-
telephonyProvider.getCarriers();
- Get all carriers
MediaProvider mediaProvider = new MediaProvider(context);
Required permission:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
File
-
mediaProvider.getFiles(storage);
- Get all files
Image
-
mediaProvider.getImages(storage);
- Get all images
Video
-
mediaProvider.getVideos(storage);
- Get all videos
Audio
-
mediaProvider.getAudios(storage);
- Get all audios
Albums
-
mediaProvider.getAlbums(storage);
- Get all albums
Artists
-
mediaProvider.getArtists(storage);
- Get all artists
Genres
-
mediaProvider.getGenres(storage);
- Get all genres
Playlists
-
mediaProvider.getPlaylists(storage);
- Get all playlists
BrowserProvider browserProvider = new BrowserProvider(context);
Required permission:
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
Bookmark
-
browserProvider.getBookmarks();
- Get all bookmarks
Search
-
browserProvider.getSearches();
- Get all searches
DictionaryProvider dictionaryProvider = new DictionaryProvider(context);
Required permission:
<uses-permission android:name="android.permission.READ_USER_DICTIONARY"/>
Word
-
dictionaryProvider.getWords();
- Get all words
Every response is wrapped with the Data
object. You can always choose if you want the list or the cursor.
To get a List
with the right model type:
List<Calendar> calendars = data.getList();
To get a Cursor
:
Cursor cursor = data.getCursor();