Thanks again.

I can say that if you have access to an exchange server then the
following examples do work in the android 4.0 level 14 emulator using
google apis at the moment:

Insert an event via Intents:
                        Intent intent = new Intent(Intent.ACTION_INSERT)
                    .setType("vnd.android.cursor.item/event")
                    .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,
0)
                    .putExtra(CalendarContract.EXTRA_EVENT_END_TIME,
1000)
                    .putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY ,
false) // just included for completeness
                    .putExtra(Events.TITLE, "My Awesome Event")
                    .putExtra(Events.DESCRIPTION, "Heading out with
friends to do something awesome.")
                    .putExtra(Events.EVENT_LOCATION, "Earth")
                    .putExtra(Events.RRULE, "FREQ=DAILY;COUNT=10")
                    .putExtra(Events.AVAILABILITY,
Events.AVAILABILITY_BUSY)
                    .putExtra(Events.ACCESS_LEVEL,
Events.ACCESS_PRIVATE)
                    .putExtra(Intent.EXTRA_EMAIL,
"my.fri...@example.com");
           startActivity(intent);


Enumerate:

                Uri uri = CalendarContract.Calendars.CONTENT_URI;
                        Log.i(TAG, "QQQ: uri: " + uri);
                        String[] projection = new String[] {
                               CalendarContract.Calendars._ID,
                               CalendarContract.Calendars.ACCOUNT_NAME,
                               CalendarContract.Calendars.ACCOUNT_TYPE,
                               CalendarContract.Calendars.NAME,
 
CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
                               CalendarContract.Calendars.CALENDAR_COLOR,
 
CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL,
                               CalendarContract.Calendars.OWNER_ACCOUNT,
                               CalendarContract.Calendars.SYNC_EVENTS,
                               CalendarContract.Calendars.CALENDAR_TIME_ZONE,
                               CalendarContract.Calendars.ALLOWED_REMINDERS,
                               CalendarContract.Calendars.VISIBLE

                        };

                        Cursor calendarCursor = managedQuery(uri, projection,
null, null, null);
                        Log.i(TAG, "cursor: " + calendarCursor);
                    if (calendarCursor != null)
                    {
                        while (calendarCursor.moveToNext())
                        {
                           //Log.i(TAG, "queryDatabase:  title: " +
cursor.getString(cursor.getColumnIndex(Notes.TITLE)) + " note: " +
cursor.getString(cursor.getColumnIndex(Notes.NOTE)));
                                Log.i(TAG, "QQQ2: cursor: _ID: " +
calendarCursor.getColumnIndex(CalendarContract.Calendars._ID));
                                for (int i = 0; i <
calendarCursor.getColumnCount(); i++) {
                                        Log.i(TAG, "QQQ2: cursor: name: " + i + 
" =
" + calendarCursor.getColumnName(i));
                                        Log.i(TAG, "QQQ2: cursor: type: " + i + 
" =
" + calendarCursor.getType(i));
                                        switch(calendarCursor.getType(i)){
                                        case Cursor.FIELD_TYPE_STRING:
                                                Log.i(TAG, "QQQ3: cursor: 
value: " + i + "
= " + calendarCursor.getString(i));
                                                break;
                                        case Cursor.FIELD_TYPE_INTEGER:
                                                Log.i(TAG, "QQQ3: cursor: 
value: " + i + "
= " + calendarCursor.getInt(i));
                                                break;
                                        case Cursor.FIELD_TYPE_FLOAT:
                                                Log.i(TAG, "QQQ3: cursor: 
value: " + i + "
= " + calendarCursor.getFloat(i));
                                                break;

                                        }

                                }

                        }
                    }
                 }

On Nov 3, 10:13 am, Mark Murphy <mmur...@commonsware.com> wrote:
> There are no samples in the SDK. I do not know if the content provider
> works in the emulator. I was planning on waiting until the source code
> for ICS ships, at which point we can start to fill in the
> documentation gaps.
>
>
>
>
>
>
>
> On Thu, Nov 3, 2011 at 9:57 AM, Ralph <fed...@gmail.com> wrote:
> > Hi Mark,
>
> > Thanks so much.
>
> > When I try to subscribe to a public google calendar via Intent on
> > Android Ice Cream Sandwich Level 14 emulator something like this:
>
> > Does anyone know how to subscribe to a public calendar via the api or
> > know where the test cases are?  Thanks.
>
> >                        Intent intent = new Intent(Intent.ACTION_INSERT)
> >                        .setData(CalendarContract.Calendars.CONTENT_URI)
> >                    .putExtra(CalendarContract.Calendars.ACCOUNT_NAME,
> > "nyc.ale...@brooklynmarathon.com")
> >                    .putExtra(CalendarContract.Calendars.ACCOUNT_TYPE,
> > "com.google.calendar")
> >                    .putExtra(CalendarContract.Calendars.NAME, "NAME:
> > nyc.ale...@brooklynmarathon.com")
> >                    
> > .putExtra(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME,
> > "CALENDAR_DISPLAY_NAME: nyc.ale...@brooklynmarathon.com")
> >                    .putExtra(CalendarContract.Calendars.CALENDAR_COLOR,
> > 0xff0000)
> >                    
> > .putExtra(CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL,
> > 700)
> >                    .putExtra(CalendarContract.Calendars.OWNER_ACCOUNT,
> > "nyc.ale...@brooklynmarathon.com")
> >                    .putExtra(CalendarContract.Calendars.SYNC_EVENTS,
> > 1)
> >                    .putExtra(CalendarContract.Calendars.CALENDAR_TIME_ZONE,
> > "GMT")
> >                    .putExtra(CalendarContract.Calendars.ALLOWED_REMINDERS,
> > "0,1")
> >                    .putExtra(CalendarContract.Calendars.VISIBLE, 1);
>
> >                        startActivity(intent);
>
> > I get:
>
> > W/ContentResolver( 4166): Failed to get type for: 
> > content://com.android.calendar/calendars
> > (Unknown URL content://com.android.cale
> > ndar/calendars)
> > I/ActivityManager(   74): START {act=android.intent.action.INSERT
> > dat=content://com.android.calendar/calendars (has extras)} from
> > pid 4166
> > D/AndroidRuntime( 4166): Shutting down VM
> > W/dalvikvm( 4166): threadid=1: thread exiting with uncaught exception
> > (group=0x409951f8)
> > E/AndroidRuntime( 4166): FATAL EXCEPTION: main
> > E/AndroidRuntime( 4166): android.content.ActivityNotFoundException: No
> > Activity found to handle Intent { act=android.intent.action
> > .INSERT dat=content://com.android.calendar/calendars (has extras) }
> > E/AndroidRuntime( 4166):        at
> > android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:
> > 1512)
> > E/AndroidRuntime( 4166):        at
> > android.app.Instrumentation.execStartActivity(Instrumentation.java:
> > 1384)
> > E/AndroidRuntime( 4166):        at
> > android.app.Activity.startActivityForResult(Activity.java:3190)
> > E/AndroidRuntime( 4166):        at
> > android.app.Activity.startActivity(Activity.java:3297)
> > E/AndroidRuntime( 4166):        at
> > com.brooklynmarathon.calendarapi2.CalendarAPI2Activity
> > $3.onClick(CalendarAPI2Activity.java:164)
>
> > E/AndroidRuntime( 4166):        at
> > android.view.View.performClick(View.java:3460)
> > E/AndroidRuntime( 4166):        at android.view.View
> > $PerformClick.run(View.java:13955)
> > E/AndroidRuntime( 4166):        at
> > android.os.Handler.handleCallback(Handler.java:605)
> > E/AndroidRuntime( 4166):        at
> > android.os.Handler.dispatchMessage(Handler.java:92)
> > E/AndroidRuntime( 4166):        at android.os.Looper.loop(Looper.java:
> > 137)
> > E/AndroidRuntime( 4166):        at
> > android.app.ActivityThread.main(ActivityThread.java:4340)
> > E/AndroidRuntime( 4166):        at
> > java.lang.reflect.Method.invokeNative(Native Method)
> > E/AndroidRuntime( 4166):        at
> > java.lang.reflect.Method.invoke(Method.java:511)
> > E/AndroidRuntime( 4166):        at com.android.internal.os.ZygoteInit
> > $MethodAndArgsCaller.run(ZygoteInit.java:784)
> > E/AndroidRuntime( 4166):        at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
> > E/AndroidRuntime( 4166):        at
> > dalvik.system.NativeStart.main(Native Method)
>
> > On Nov 3, 8:26 am, Mark Murphy <mmur...@commonsware.com> wrote:
> >> I am assuming that they mean ACTION_INSERT, ACTION_EDIT, ACTION_VIEW,
> >> ACTION_PICK, etc. on eitherCalendarContract.CONTENT_URI 
> >> orCalendarContract.Events.CONTENT_URI. I have not tried these yet.
>
> >> On Thu, Nov 3, 2011 at 6:56 AM, Ralph <fed...@gmail.com> wrote:
> >> > But the announcement below refers to intents but it also says once the
> >> > new apis arrive
>
> >> > when do the new apis arrive?
>
> >> > From google:
> >> > "We want to see lots of good calendar apps and extensions that work
> >> > reliably across Android devices, and aren't broken by platform
> >> > updates. So we decided to create a clean API, including a
> >> > comprehensive set of Intents, to manage calendar data in ICS. Now
> >> > anyone can code against these new APIs and know that Android is
> >> > committed to supporting them, and that partners have to support these
> >> > APIs as part of CTS.
>
> >> > Once the new APIs arrive, you’re ..."
>
> >> > On Nov 2, 11:06 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote:
> >> >> The ICS has not been relased.  There are no "Intents".  It's a
> >> >> ContentProvider.
>
> >> >> On Nov 3, 11:04 am, Ralph <fed...@gmail.com> wrote:
>
> >> >> > Hi
>
> >> >> > And thanks.
>
> >> >> > I see in the ICS announcement that the calender API and intents are
> >> >> > documented or at least that is what is written but does anyone see the
> >> >> > actual docs or source or test cares
>
> >> >> > I must be looking in the incorrect place.
>
> >> >> > I grep'ed through the Android source tree that I downloaded and I find
> >> >> > no reference toCalendarContract
>
> >> >> > On Nov 2, 9:54 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote:
>
> >> >> > > No, Google Account seem to be broken on the ICS emulator:
>
> >> >> > >http://groups.google.com/group/android-developers/browse_thread/threa...
>
> >> >> > > On Nov 3, 5:44 am, Ralph <fed...@gmail.com> wrote:
>
> >> >> > > > Hi,
>
> >> >> > > > I'd also like to try out adding a subscription to a public google
> >> >> > > > calendar.
>
> >> >> > > > Where are the Intents documented?  Or at least where are the test
> >> >> > > > cases that test adding a public calendar to an account and making 
> >> >> > > > it
> >> >> > > > visible and sync'ed?
>
> >> >> > > > I seem to only see a way to add an event to a particular calendar.
>
> >> >> > > > Also, the emulator does not seem to support Google calendar 
> >> >> > > > accounts.
> >> >> > > > The only thing that seems to work with calendar is Exchange.  
> >> >> > > > Which
> >> >> > > > seems odd.
>
> >> >> > > > Does anyone have the emulator working with google calendars?
>
> >> >> > > > Thanks,
> >> >> > > > Ralph
>
> >> >> > > > On Oct 25, 4:50 am, Zsolt Vasvari <zvasv...@gmail.com> wrote:
>
> >> >> > > > > Thanks, of course that will work.  Duh...  How did I miss that?
>
> >> >> > > > > That said, I am just looking in the Javadocs and under 
> >> >> > > > > Constants,
> >> >> > > > > CONTENT_URI is not listed, but it's further down, under Fields. 
> >> >> > > > >  That
> >> >> > > > > explains why I didn't see it, even though it's not a real 
> >> >> > > > > excuse.
> >> >> > > > > Since CONENT_URI is a "static final", why isn't it listed under
> >> >> > > > > Constants?
>
> >> >> > > > > On Oct 25, 2:41 pm, Michael Chan <mc...@android.com> wrote:
>
> >> >> > > > > > Hi Zsolt,
>
> >> >> > > > > > Can you tryCalendarContract.Calendars.CONTENT_URI instead of
> >> >> > > > > >CalendarContract.CONTENT_URI?
>
> >> >> > > > > > Thanks,
> >> >> > > > > > Mike
>
> >> >> > > > > > On Oct 24, 5:39 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote:
>
> >> >> > > > > > > I would have expected to work, also.
>
> >> >> > > > > > > It's kind of frustrating that the first time we are goig to 
> >> >> > > > > > > be able
> >> >> > > > > > > "put out fires", is when the general public will get hold 
> >> >> > > > > > > of the first
> >> >> > > > > > > ICS device.  The emulator is all but useless.
>
> >> >> > > > > > > On Oct 25, 12:25 am, Mark Murphy <mmur...@commonsware.com> 
> >> >> > > > > > > wrote:
>
> >> >> > > > > > > > I haven't had a chance to yet, and probably won't for a 
> >> >> > > > > > > > few weeks.
> >> >> > > > > > > > Since the Calendar app is in the emulator, I would have 
> >> >> > > > > > > > expected that
> >> >> > > > > > > > content provider to work. It's possible that it is an 
> >> >> > > > > > > > emulator bug --
> >> >> > > > > > > > without hardware as a point of reference, it is difficult 
> >> >> > > > > > > > to tell.
>
> >> >> > > > > > > > On Mon, Oct 24, 2011 at 10:19 AM, Zsolt Vasvari 
> >> >> > > > > > > > <zvasv...@gmail.com> wrote:
> >> >> > > > > > > > > Nobody tried this new API yet?
>
> >> >> > > > > > > > > On Oct 24, 2:57 pm, Zsolt Vasvari <zvasv...@gmail.com> 
> >> >> > > > > > > > > wrote:
> >> >> > > > > > > > >> I am trying to convert my Calendar code to the new ICS 
> >> >> > > > > > > > >> APIs.
>
> >> >> > > > > > > > >> For starters, I am trying the simplest possible 
> >> >> > > > > > > > >> operation -- reading
> >> >> > > > > > > > >> the list of Calendars.
>
> >> >> > > > > > > > >> I am using the following code:
>
> >> >> > > > > > > > >> context.getContentResolver().query(CalendarContract.CONTENT_URI,
> >> >> > > > > > > > >> CALENDARS_PROJECTION, CALENDARS_WHERE, null,
> >> >> > > > > > > > >>CalendarContract.Calendars.DEFAULT_SORT_ORDER)
>
> >> >> > > > > > > > >> but I am getting an unknown URL exception on the ICS 
> >> >> > > > > > > > >> emulator, both
> >> >> > > > > > > > >> Standard and Google API images:
>
> >> >> > > > > > > > >> E/ACRA    (  746): Caused by: 
> >> >> > > > > > > > >> java.lang.IllegalArgumentException:
> >> >> > > > > > > > >> Unknown URL content://com.android.calendar
> >> >> > > > > > > > >> E/ACRA    (  746):      at
> >> >> > > > > > > > >> android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:
> >> >> > > > > > > > >> 165)
> >> >> > > > > > > > >> E/ACRA    (  746):      at
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to