Last active
August 29, 2015 14:19
-
-
Save kmdupr33/02f61591f40f459ae40c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onHandleIntent(Intent intent) { | |
final String action = intent.getAction(); | |
Log.d(TAG, "Received intent: " + action); | |
final ContentResolver resolver = getContentResolver(); | |
boolean isAddEvent = false; | |
if (ACTION_ADD_SESSION_CALENDAR.equals(action)) { | |
isAddEvent = true; | |
} else if (ACTION_REMOVE_SESSION_CALENDAR.equals(action)) { | |
isAddEvent = false; | |
} else if (ACTION_UPDATE_ALL_SESSIONS_CALENDAR.equals(action) && | |
PrefUtils.shouldSyncCalendar(this)) { | |
try { | |
getContentResolver().applyBatch(CalendarContract.AUTHORITY, | |
processAllSessionsCalendar(resolver, getCalendarId(intent))); | |
sendBroadcast(new Intent( | |
SessionCalendarService.ACTION_UPDATE_ALL_SESSIONS_CALENDAR_COMPLETED)); | |
} catch (RemoteException e) { | |
LOGE(TAG, "Error adding all sessions to Google Calendar", e); | |
} catch (OperationApplicationException e) { | |
LOGE(TAG, "Error adding all sessions to Google Calendar", e); | |
} | |
} else if (ACTION_CLEAR_ALL_SESSIONS_CALENDAR.equals(action)) { | |
try { | |
getContentResolver().applyBatch(CalendarContract.AUTHORITY, | |
processClearAllSessions(resolver, getCalendarId(intent))); | |
} catch (RemoteException e) { | |
LOGE(TAG, "Error clearing all sessions from Google Calendar", e); | |
} catch (OperationApplicationException e) { | |
LOGE(TAG, "Error clearing all sessions from Google Calendar", e); | |
} | |
} else { | |
return; | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment