android – 什么是CalendarContract.EventsColumns.CUSTOM_APP_URI?

标题说明了一切:CalendarContract.EventsColumns.CUSTOM_APP_URI是什么?

我问,因为我正在寻找一个我的应用程序可以将一些特定于应用程序的数据填充到Events表中的地方.也许这是一个徒劳的问题,因为当然,我需要确保其他一些应用程序不会丢弃我的数据.

也许更好的问题是:如何在日历事件表中存储特定于应用程序的数据?

最佳答案 正如CalendarContract中的一样:

/**
 * Activity Action: Display the event to the user in the custom app as
 * specified in {@link EventsColumns#CUSTOM_APP_PACKAGE}. The custom app
 * will be started via {@link Activity#startActivityForResult(Intent, int)}
 * and it should call {@link Activity#setResult(int)} with
 * {@link Activity#RESULT_OK} or {@link Activity#RESULT_CANCELED} to
 * acknowledge whether the action was handled or not.
 *
 * The custom app should have an intent-filter like the following
 * <pre>
 * {@code
 * <intent-filter>
 *    <action android:name="android.provider.calendar.action.HANDLE_CUSTOM_EVENT" />
 *    <category android:name="android.intent.category.DEFAULT" />
 *    <data android:mimeType="vnd.android.cursor.item/event" />
 * </intent-filter>
 * }
 * </pre>
 * <p>
 * Input: {@link Intent#getData} has the event URI. The extra
 * {@link #EXTRA_EVENT_BEGIN_TIME} has the start time of the instance. The
 * extra {@link #EXTRA_CUSTOM_APP_URI} will have the
 * {@link EventsColumns#CUSTOM_APP_URI}.
 * <p>
 * Output: {@link Activity#RESULT_OK} if this was handled; otherwise
 * {@link Activity#RESULT_CANCELED}
 */

// @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_HANDLE_CUSTOM_EVENT =
        “android.provider.calendar.action.HANDLE_CUSTOM_EVENT”;

点赞