2 * Copyright 2012 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.
17 package com
.google
.android
.gcm
;
20 * Constants used by the GCM library.
22 public final class GCMConstants
{
25 * Intent sent to GCM to register the application.
27 public static final String INTENT_TO_GCM_REGISTRATION
=
28 "com.google.android.c2dm.intent.REGISTER";
31 * Intent sent to GCM to unregister the application.
33 public static final String INTENT_TO_GCM_UNREGISTRATION
=
34 "com.google.android.c2dm.intent.UNREGISTER";
37 * Intent sent by GCM indicating with the result of a registration request.
39 public static final String INTENT_FROM_GCM_REGISTRATION_CALLBACK
=
40 "com.google.android.c2dm.intent.REGISTRATION";
43 * Intent used by the GCM library to indicate that the registration call
46 public static final String INTENT_FROM_GCM_LIBRARY_RETRY
=
47 "com.google.android.gcm.intent.RETRY";
50 * Intent sent by GCM containing a message.
52 public static final String INTENT_FROM_GCM_MESSAGE
=
53 "com.google.android.c2dm.intent.RECEIVE";
56 * Extra used on {@link #INTENT_TO_GCM_REGISTRATION} to indicate the sender
57 * account (a Google email) that owns the application.
59 public static final String EXTRA_SENDER
= "sender";
62 * Extra used on {@link #INTENT_TO_GCM_REGISTRATION} to get the application
65 public static final String EXTRA_APPLICATION_PENDING_INTENT
= "app";
68 * Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
69 * that the application has been unregistered.
71 public static final String EXTRA_UNREGISTERED
= "unregistered";
74 * Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
75 * an error when the registration fails. See constants starting with ERROR_
76 * for possible values.
78 public static final String EXTRA_ERROR
= "error";
81 * Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
82 * the registration id when the registration succeeds.
84 public static final String EXTRA_REGISTRATION_ID
= "registration_id";
87 * Type of message present in the {@link #INTENT_FROM_GCM_MESSAGE} intent.
88 * This extra is only set for special messages sent from GCM, not for
89 * messages originated from the application.
91 public static final String EXTRA_SPECIAL_MESSAGE
= "message_type";
94 * Special message indicating the server deleted the pending messages.
96 public static final String VALUE_DELETED_MESSAGES
= "deleted_messages";
99 * Number of messages deleted by the server because the device was idle.
100 * Present only on messages of special type
101 * {@link #VALUE_DELETED_MESSAGES}
103 public static final String EXTRA_TOTAL_DELETED
= "total_deleted";
106 * Permission necessary to receive GCM intents.
108 public static final String PERMISSION_GCM_INTENTS
=
109 "com.google.android.c2dm.permission.SEND";
112 * @see GCMBroadcastReceiver
114 public static final String DEFAULT_INTENT_SERVICE_CLASS_NAME
=
118 * The device can't read the response, or there was a 500/503 from the
119 * server that can be retried later. The application should use exponential
120 * back off and retry.
122 public static final String ERROR_SERVICE_NOT_AVAILABLE
=
123 "SERVICE_NOT_AVAILABLE";
126 * There is no Google account on the phone. The application should ask the
127 * user to open the account manager and add a Google account.
129 public static final String ERROR_ACCOUNT_MISSING
=
133 * Bad password. The application should ask the user to enter his/her
134 * password, and let user retry manually later. Fix on the device side.
136 public static final String ERROR_AUTHENTICATION_FAILED
=
137 "AUTHENTICATION_FAILED";
140 * The request sent by the phone does not contain the expected parameters.
141 * This phone doesn't currently support GCM.
143 public static final String ERROR_INVALID_PARAMETERS
=
144 "INVALID_PARAMETERS";
146 * The sender account is not recognized. Fix on the device side.
148 public static final String ERROR_INVALID_SENDER
=
152 * Incorrect phone registration with Google. This phone doesn't currently
155 public static final String ERROR_PHONE_REGISTRATION_ERROR
=
156 "PHONE_REGISTRATION_ERROR";
158 private GCMConstants() {
159 throw new UnsupportedOperationException();