3

デバイスのカレンダーにイベントを追加するアプリケーションがあります。Calendar ContentProvider の次の URL があります。

Pre Froyo: content://calendar/calendars
Froyo: content://com.android.calendar/calendars

これらの URL は Nexus One では正常に機能しますが、HTC Desire/Incredible/Hero ではカレンダーが返されません。おそらく、Sense UI を備えたすべての電話。これは 2.1 および 2.2 で発生します。

以前にこの問題に遭遇した人はいますか?回避策はありますか?

4

1 に答える 1

3

このコードを使用して、プラットフォームの URI を取得します

private String getCalendarUriBase() {

            String calendarUriBase = null;
            Uri calendars = Uri.parse("content://calendar/calendars");
            Cursor managedCursor = null;
            try {
                managedCursor = managedQuery(calendars, null, null, null, null);
            } catch (Exception e) {
            }
            if (managedCursor != null) {
                calendarUriBase = "content://calendar/";
            } else {
                calendars = Uri.parse("content://com.android.calendar/calendars");
                try {
                    managedCursor = managedQuery(calendars, null, null, null, null);
                } catch (Exception e) {
                }
                if (managedCursor != null) {
                    calendarUriBase = "content://com.android.calendar/";
                }
            }
            return calendarUriBase;
        }
于 2011-02-25T13:06:54.640 に答える