첫 번째 질문 : 캘린더 액세스 : 이것은 content : // calendar/calendars URI를 기반으로합니다. 먼저 응용 프로그램이 android.permission.READ_CALENDAR 권한을 정의하는지 확인하십시오.
이 캘린더 ID 및 표시 이름을 가져 오기 : 특정 일정에
ContentResolver myContentResolver = getContentResolver();
final Cursor cursor = myContentResolver.query(Uri.parse("content://calendar/calendars"),
(new String[] { "_id", "displayName", "selected" }), null, null, null);
while (cursor.moveToNext()) {
final String _id = cursor.getString(0);
final String displayName = cursor.getString(1);
final Boolean selected = !cursor.getString(2).equals("0");
}
일 :
Uri.Builder myUriBuilder = Uri.parse("content://calendar/instances/when").buildUpon();
long currentTime = new Date().getTime();
ContentUris.appendId(myUriBuilder , currentTime - DateUtils.WEEK_IN_MILLIS);
ContentUris.appendId(myUriBuilder, currentTime + DateUtils.WEEK_IN_MILLIS);
Cursor eventCursor = myContentResolver.query(myUriBuilder.build(),
new String[] { "title", "begin", "end", "allDay"}, "Calendars._id=" + id,
null, "startDay ASC, startMinute ASC");
while (eventCursor.moveToNext()) {
// fields:
// Event title - String - 0
String eventTitle = eventCursor.getString(0);
// Event start time - long - 1
Date startTime = new Date(eventCursor.getLong(1));
// Event end time - login - 2
Date endTime = new Date(eventCursor.getLong(2));
// Is it an All Day Event - String - 3 (0 is false, 1 is true)
Boolean allDay = !eventCursor.getString(3).equals("0");
}
두 번째 질문 : 예약 이벤트 : 는 기본적으로, 당신은 알람 관리기 클래스를 사용해야합니다, 자세한 내용은 android SDK를 참조하십시오. 예는 지금부터 행사 3 시간 설정 :
이
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR, 3);
Intent intent = new Intent(this, MyAlarmHandler.class);
intent.putExtra("alarm_message", "Wake up!");
int requestCode = 3824723; // this is not currently used by Android.
PendingIntent pIntent = PendingIntent.getBroadcast(this, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pIntent);
이 세 번째 질문 : 네,이 PHP 접근에게 놀라운 답변
감사를 제안 .. 당신이 어떻게 구글에 액세스하는 방법을 말해 줄래 달력 ?? 그 달력은 웹상에 ..? –
캘린더를 루프 할 때 (첫 번째 단계) _ _ displayName _ 필드를 확인하십시오. –