2016-01-27 41 views
-1

我正在嘗試在我的應用中整合Google日曆以將我的活動添加到Google日曆,但我不知道如何整合。請任何一個你能幫助我提前如何在我的android應用程序中集成G​​oogle日曆?

+0

請CHCK我的編輯解決方案...它可以幫助for..let我知道在關注 –

+0

的情況下,爵士我的要求是,我需要添加日期和事件,谷歌日曆API,從那以後,我需要得到來自Google日曆API的通知。所以我可以用這種幫助嗎? - –

+0

https://developers.google.com/google-apps/calendar/quickstart/android – Dhina

回答

1

謝謝如果你想在你的應用程序直接使用Google日曆,您可以使用此GitHub的庫,提供了很多定製的:

  1. Caldroid
  2. Android-Week-View

但是如果你希望使用的日曆,你應該與這些意圖工作:

在你的代碼試試這個:

Calendar cal = Calendar.getInstance();    
Intent intent = new Intent(Intent.ACTION_EDIT); 
intent.setType("vnd.android.cursor.item/event"); 
intent.putExtra("beginTime", cal.getTimeInMillis()); 
intent.putExtra("allDay", true); 
intent.putExtra("rrule", "FREQ=YEARLY"); 
intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000); 
intent.putExtra("title", "A Test Event from android app"); 
startActivity(intent); 

添加權限..

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android"...> 
    <uses-sdk android:minSdkVersion="14" /> 
    <uses-permission android:name="android.permission.READ_CALENDAR" /> 
    <uses-permission android:name="android.permission.WRITE_CALENDAR" /> 
    ... 
</manifest> 

而對於谷歌日曆的訪問,最好的辦法是使用Google Calendar API

相關問題