本文介绍了如何通过Android应用程序查看公共谷歌日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一定是经过基础上,谷歌日历,到目前为止,没有运气什么那么曾经堆栈溢出的问题了。我一直在想这几个小时,得到很少或没有结果的。

I must've gone through ever Stack Overflow question based on the Google Calendar so far with no luck what so ever. I've been trying this for hours now and got little to no results at all.

我是pretty新的程序员使用Java和Android,具有相当经验少了,因为它是该领域的。基本上,我遇到的主要问题是看其设置为公开,其他用户的谷歌日历。

I'm a pretty new programmer with Java and Android, with quite little experience out of the field as it is. Basically the main problem I am having is with viewing another user's Google Calendar which is set to public.

目前,来自谷歌的教程和其他网站我已经设法获得日历显示,这是足以pretty简单。它只会加载和显示当前用户的日历。这可以从字面上可以用做(与布局一个简单的按钮)。

At the moment, from the Google tutorials and other sites I've managed to get the calendar showing, which is pretty simple enough. It'll just load up and show the current user's calendar. Which can literally be done with (with a simple button in the layout).

    public void onClick(View view) {
    // A date-time specified in milliseconds since the epoch.
    long startMillis = System.currentTimeMillis();

    Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
    builder.appendPath("time");
    ContentUris.appendId(builder, startMillis);
    Intent intent = new Intent(Intent.ACTION_VIEW).setData(builder.build());
    startActivity(intent);
}

显然,这在任何用户数据没有通过的公共账号什么的,我已经通过的开发的谷歌教程中的指南。我试图设置帐户细节的东西,但它只是永远不会奏效。我一直试图做它作为一个同步适配器,但老实说,我只知道我不这样做是正确的。我不知道如果我真的甚至需要使用同步适配器,因为所有我想要做的就是字面上看到的事件,没有任何修改或更新任何东西。

Obviously this doesn't pass in any user data for the public account or anything, I've been reading through the Calendar Provider Developer guides within the Google tutorials. I've tried to set up the account details thing, but it just never works. I've tried to do it as a Sync Adapter, but honestly I just know I'm not doing it right. I don't know if I really even need to use a Sync Adapter as all I want to do is literally see the events, not modify anything or update anything.

我使用的API 14+,并希望用户日历提供商等,这看起来很简单,但我一直在抨击我的头这几天,投入了大量的时间进去的,看似没有什么我做的工作。至少我有某种日历开放,但它不是我想要的。

I am using API 14+ and want to user the Calendar Provider etc. It looks simple enough but I've been bashing my head against this for a few days and put a lot of hours into it and seemingly nothing I do works. At least I've got some sort of calendar opening but it's not what I want.

时的这一切只是下到同步适配器?如果是的话我怎么就能叫出月历?类似的另一个问题了。

Is it all just down to the sync adapter? If so how will I be able to call a calendar? Another question similar had

private static Uri buildCalUri() {
return CalendarContract.Calendars.CONTENT_URI
        .buildUpon()
        .appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true")
        .appendQueryParameter(Calendars.ACCOUNT_NAME, ACCOUNT_NAME)
        .appendQueryParameter(Calendars.ACCOUNT_TYPE, CalendarContract.ACCOUNT_TYPE_LOCAL)
        .build();

}

我希望这是类似我所需要的东西,但我非常不确定。在开发者教程ACCOUNT_TYPE_LOCAL是很重要的,如果该帐户不是设备

I'm hoping this is something similar to what I need but I'm very unsure. In the developer tutorial ACCOUNT_TYPE_LOCAL was important if the account wasn't on the device

任何帮助将大大AP preciated!

Any help will be greatly appreciated!

推荐答案

如果你正在寻找公共谷歌日历(www.google.com/calendar)与您的Andr​​oid应用程序集成,则必须使用的。

If you are looking to integrate the public Google Calendar (www.google.com/calendar) with your Android Application, you have to use the Google Calendar API.

最简单的方法是从这里下载使用创建一个应用程序。

You will first need to go to API Console to create an App with Calendar API Access .

如果你不希望使用本地库,你甚至可以使用REST API做(使用HTTP GET和放大器; POST指令)的

If you do not want to use the native library, you can even do it using REST API (use HTTP GET & POST Commands), example App here

希望这有助于。

这篇关于如何通过Android应用程序查看公共谷歌日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 01:23
查看更多