2 * Copyright 2011 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.google.ipc.invalidation.ticl.android2.channel;
18 import com.google.ipc.invalidation.ticl.proto.AndroidChannel.MajorVersion;
19 import com.google.ipc.invalidation.ticl.proto.ClientProtocol.Version;
22 * Constants used by the network channel.
25 public final class AndroidChannelConstants {
27 /** Constants used in Intents sent to retrieve auth tokens from the application. */
28 public static class AuthTokenConstants {
30 * Action requesting that an auth token to send a message be provided. This is the action
31 * used in the intent to the application.
33 public static final String ACTION_REQUEST_AUTH_TOKEN =
34 "com.google.ipc.invalidation.AUTH_TOKEN_REQUEST";
36 /** Extra in an auth token request response providing the pending intent. */
37 public static final String EXTRA_PENDING_INTENT =
38 "com.google.ipc.invalidation.AUTH_TOKEN_PENDING_INTENT";
41 * Extra in an auth token request message indicating that the token provided as the value
42 * was invalid when last used. This may be set on the intent to the application.
44 public static final String EXTRA_INVALIDATE_AUTH_TOKEN =
45 "com.google.ipc.invalidaton.AUTH_TOKEN_INVALIDATE";
47 /** Extra in the intent from the application that provides the auth token string. */
48 public static final String EXTRA_AUTH_TOKEN = "com.google.ipc.invalidation.AUTH_TOKEN";
51 * Extra in the intent from the application that provides the so-called "auth token type". If
52 * the auth token is a GoogleLogin token, then this value must name the Gaia service (e.g.,
53 * "chromiumsync") for which the token was generated. If the auth token is a Gaia OAuth2 token,
54 * then this value must have the form "oauth2:{scope}", where {scope} is a Google API
55 * authentication scope such as "https://www.googleapis.com/auth/chromesync".
57 public static final String EXTRA_AUTH_TOKEN_TYPE =
58 "com.google.ipc.invalidation.AUTH_TOKEN_TYPE";
61 * Extra in the intent from the application that provides the message to send. We store this
62 * ourselves in the intent inside the pending intent that we give to the application.
64 static final String EXTRA_STORED_MESSAGE = "com.google.ipc.invalidation.AUTH_TOKEN_MSG";
67 * Extra in the intent from the application that indicates whether the intent is for a retry
68 * after a failed authentication. If we find that an auth token no longer works, we will tell
69 * the application to invalidate it, retrieve a new one, and send us back the message and the
70 * new token, but we do not want to go into an infinite loop if authentication never succeeds.
72 static final String EXTRA_IS_RETRY = "com.google.ipc.invalidation.AUTH_TOKEN_IS_RETRY";
75 /** Constants used in HTTP requests to the data center. */
76 public static class HttpConstants {
77 /** The URL of the invalidation channel service */
78 public static final String CHANNEL_URL = "https://clients4.google.com/";
80 /** The MIME content type to use for requests that contain binary protobuf */
81 public static final String PROTO_CONTENT_TYPE = "application/x-protobuffer";
83 /** The relative URL to use to send inbound client requests to the Android frontend */
84 public static final String REQUEST_URL = "/invalidation/android/request/";
87 * The name of the query parameter that contains the service name that should be used to
88 * validate the authentication token provided with the request.
90 public static final String SERVICE_PARAMETER = "service";
93 * The name of the header that contains the echoed token. This token is included in all C2DM
94 * messages to the client and is echoed back under this header on all client HTTP requests.
96 public static final String ECHO_HEADER = "echo-token";
99 /** Constants used in C2DM messages. */
100 public static class C2dmConstants {
102 * Name of C2DM parameter containing message content. If not set, data is retrieved via
103 * the mailbox frontend
105 public static final String CONTENT_PARAM = "content";
107 /** Name of the C2DM parameter containing an opaque token to be echoed on HTTP requests. */
108 public static final String ECHO_PARAM = "echo-token";
111 /** The channel version expected by this channel implementation. */
112 public static final Version CHANNEL_VERSION = Version.create(MajorVersion.INITIAL, 0);
115 * An extra set on an intent to the AndroidMessageSenderService to inform it that a GCM
116 * registration id change has occurred. This is sent by the AndroidMessageReceiverService
117 * to trigger the sender service to send any buffered messages when a GCM registration id first
120 * The value associated with this extra is ignored.
122 static final String MESSAGE_SENDER_SVC_GCM_REGID_CHANGE =
123 "com.google.ipc.invalidation.channel.sender.gcm_regid_change";
125 private AndroidChannelConstants() {
126 // Disallow instantiation.