public class

WearableCalendarContract

extends java.lang.Object

 java.lang.Object

↳androidx.wear.provider.WearableCalendarContract

Gradle dependencies

compile group: 'androidx.wear', name: 'wear', version: '1.4.0-alpha01'

  • groupId: androidx.wear
  • artifactId: wear
  • version: 1.4.0-alpha01

Artifact androidx.wear:wear:1.4.0-alpha01 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.wear:wear com.android.support:wear

Overview

The contract between the wearable calendar provider and applications. This API provides a subset of the data available through , but is automatically synced to wearable devices.

Summary

Fields
public static final UriCONTENT_URI

The content:// style URL for the top-level wearable calendar authority.

Methods
public static voidaddCalendarAuthorityUri(UriMatcher uriMatcher, java.lang.String path, int code)

Adds uri to match to the given with calendar authority, java.lang.String path and the integer code to return when this Uri is matched.

public static voidaddCalendarDataAuthority(IntentFilter intentFilter, java.lang.String port)

Adds new to the given with calendar data authority and java.lang.String host to match.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public static final Uri CONTENT_URI

The content:// style URL for the top-level wearable calendar authority.

Methods

public static void addCalendarAuthorityUri(UriMatcher uriMatcher, java.lang.String path, int code)

Adds uri to match to the given with calendar authority, java.lang.String path and the integer code to return when this Uri is matched.

Parameters:

uriMatcher: The UriMatcher holding matches.
path: The path to match in calendar authority. * may be used as a wild card for any text, and # may be used as a wild card for numbers.
code: The code that is returned when a Uri is matched against the calendar authority and path. Must be positive.

public static void addCalendarDataAuthority(IntentFilter intentFilter, java.lang.String port)

Adds new to the given with calendar data authority and java.lang.String host to match.

Parameters:

intentFilter: The IntentFilter holding matches.
port: Optional port part of the authority to match. If null, any port is allowed.

Source

/*
 * Copyright 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.wear.provider;

import android.content.IntentFilter;
import android.content.UriMatcher;
import android.net.Uri;
import android.provider.CalendarContract;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * The contract between the wearable calendar provider and applications. This API provides a subset
 * of the data available through {@link CalendarContract}, but is automatically synced to wearable
 * devices.
 */
public class WearableCalendarContract {
    private static final String AUTHORITY = "com.google.android.wearable.provider.calendar";

    /**
     * Adds uri to match to the given {@link UriMatcher} with calendar authority, {@link String}
     * path and the integer code to return when this Uri is matched.
     * @param uriMatcher    The UriMatcher holding matches.
     * @param path          The path to match in calendar authority. * may be used as a wild card
     *                      for any text, and # may be used as a wild card for numbers.
     * @param code          The code that is returned when a Uri is matched against the calendar
     *                      authority and path. Must be positive.
     */
    public static void addCalendarAuthorityUri(@NonNull UriMatcher uriMatcher, @NonNull String path,
            int code) {
        uriMatcher.addURI(AUTHORITY, path, code);
    }

    /**
     * Adds new {@link android.content.Intent} to the given {@link IntentFilter} with calendar data
     * authority and {@link String} host to match.
     * @param intentFilter  The IntentFilter holding matches.
     * @param port          Optional port part of the authority to match. If null, any port is
     *                      allowed.
     */
    public static void addCalendarDataAuthority(
            @NonNull IntentFilter intentFilter, @Nullable String port) {
        intentFilter.addDataAuthority(AUTHORITY, port);
    }

    /** The content:// style URL for the top-level wearable calendar authority. */
    @NonNull
    public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);

    /** @see android.provider.CalendarContract.Instances */
    public static final class Instances {
        private Instances() {
        }

        @NonNull
        public static final Uri CONTENT_URI =
                Uri.withAppendedPath(WearableCalendarContract.CONTENT_URI, "instances/when");
    }

    /** @see android.provider.CalendarContract.Attendees */
    public static final class Attendees {
        private Attendees() {
        }

        @NonNull
        public static final Uri CONTENT_URI =
                Uri.withAppendedPath(WearableCalendarContract.CONTENT_URI, "attendees");
    }

    /** @see android.provider.CalendarContract.Reminders */
    public static final class Reminders {
        private Reminders() {
        }

        @NonNull
        public static final Uri CONTENT_URI =
                Uri.withAppendedPath(WearableCalendarContract.CONTENT_URI, "reminders");
    }

    private WearableCalendarContract() {}
}