Hi Michael, Thanks again.
Are you saying there is no way to help the user subscribe to a public google calendar via the new calendar api? I am already subscribing using some example from Yaniv Inbar a while back: where ALERT_CALENDAR is "nyc.ale...@brooklynmarathon.com" Is there a better, more supported way to do this? Also what do you mean by using the browser? Can I make the calendar visible and sync'ed via the browser? Thanks, Ralph private void subscribeCalendar() { CalendarUrl url = CalendarUrl.forAllCalendarsFeed(); Log.i(TAG,"ADD NEW CALENDAR: " + url); CalendarEntry calendar = new CalendarEntry(); //calendar should have something like setid of gdata api calendar.id = ALERT_CALENDAR; //calendar.title = "Test: " + new DateTime(new Date()); try { calendar.executeInsert(transport, url); AlertDialog builder; try { builder = MessageDialogBuilder.create(this, MESSAGE ); builder.show(); } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException e) { handleException(e); } } On Nov 4, 12:38 pm, Michael Chan <mc...@android.com> wrote: > Hi Ralph, > > I wish I have a solution for you. That's not supported right now. The only > (not so good) way is to use the browser. I will file an internal feature > request if we don't have one already. > > Thanks, > Mike > > > > > > > > On Fri, Nov 4, 2011 at 7:24 AM, Ralph <fed...@gmail.com> wrote: > > Hi Michael and thank you. > > > Can you let us know the recommended way to subscribe a user to a > > public google calendar. > > > For example, let's say you have a google calendar with public > > information. for example, some city alerts etc. data. > > > We want to make it easy for the user to subscribe to the public > > calendar and make it sync'ed and visible (with their permission of > > course) > > > Today, I have to give them instructions and it seems that each phone > > manufacturer has implemented the calendar in a different way so the > > instructions are very complicated. What I'd like to send the user to > > a screen with the calendar subscription (visible and sync'ed) already > > set up and let them confirm it. > > > Thanks, > > Ralph > > > On Nov 3, 2:29 pm, Michael Chan <mc...@android.com> wrote: > > > Hi, > > > > I believe the GoogleCalendarSyncAdapter was not included in the > > > emulator. That's why you can't sync Google Calendars in the emulator. > > > > The new Calendar API will support viewing, adding events (not > > > calendars) via Intents. The user will need to confirm before the event > > > is saved. > > > > Adding *Google* calendars via the provider is not supported at this > > > time. > > > > We will be publishing a developer guide for Calendar APIs with more > > > details on the set of supported intents as well as code snippets. > > > > managedQuery has been deprecated. It can cause ANRs. The recommend way > > > is to use a CursorLoader (http://developer.android.com/reference/ > > > android/content/CursorLoader.html). If you just need to read the data > > > and can close the query immediately, you can still do a query (in a > > > non-UI thread), read the data you want, and close the cursor. > > > > Thanks, > > > Mike > > > > On Nov 3, 8:20 am, Ralph <fed...@gmail.com> wrote: > > > > > 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) > > ... > > 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