-1

我试图在Android应用程序中使用Google Cloud Datastore进行简单的读/写功能。使用Gradle的'Google Cloud Datastore API客户端库Java版'

我继续到this页面,并编译了这个“compile 'com.google.apis:google-api-services-datastore:v1beta2-rev31-1.22.0'”gradle依赖和MavenCentral仓库。

我后来去到批处理文件here但编译gradle这个图书馆没有在此示例代码中使用的日历类:

JsonBatchCallback<Calendar> callback = new JsonBatchCallback<Calendar>() { 

    public void onSuccess(Calendar calendar, HttpHeaders responseHeaders) { 
    printCalendar(calendar); 
    addedCalendarsUsingBatch.add(calendar); 
    } 

    public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) { 
    System.out.println("Error Message: " + e.getMessage()); 
    } 
}; 

... 

Calendar client = Calendar.builder(transport, jsonFactory, credential) 
    .setApplicationName("BatchExample/1.0").build(); 
BatchRequest batch = client.batch(); 

Calendar entry1 = new Calendar().setSummary("Calendar for Testing 1"); 
client.calendars().insert(entry1).queue(batch, callback); 

Calendar entry2 = new Calendar().setSummary("Calendar for Testing 2"); 
client.calendars().insert(entry2).queue(batch, callback); 

batch.execute(); 

什么其他的依赖,我需要编译得到那个班?

我搜索了一遍,查看了其他stackoverflow问题here和示例项目here,我似乎无法找到如何使用Google数据存储区执行CRUD操作的简单演示。有人可以请我指出一些全面的文档/教程的方向,该教程解释了如何在不使用Google App Engine的情况下在Google Datastore上执行CRUD操作?

在此先感谢

+0

为什么这个问题downvoted? –

+0

问题要求我们推荐或找到一本书,工具,软件库,**教程**或其他非现场资源,因为它们倾向于吸引自以为是的答案和垃圾邮件,所以不适合堆栈溢出。 – mjn

+0

感谢您的解释,我很感激 –

回答

2

如您链接页面解释说:

使用Calendar API批次的一个完整的例子是 日历CMDLINE样本中找到。

的Calenadar API主页是:

https://developers.google.com/api-client-library/java/apis/calendar/v3

在那里,它表明的摇篮脚本需要:

repositories { 
    mavenCentral() 
} 

dependencies { 
    compile 'com.google.apis:google-api-services-calendar:v3-rev191-1.22.0' 
} 
+0

感谢您的回答。我会更多地考虑这个例子。我还发现[this](http://googlecloudplatform.github.io/gcloud-java/0.2.3/index.html)库。 –

相关问题