]>
Commit | Line | Data |
---|---|---|
8dfb76c9 MG |
1 | /* |
2 | * Copyright 2012 Google Inc. | |
3 | * | |
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 | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
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. | |
15 | */ | |
16 | ||
17 | package com.google.android.gcm; | |
18 | ||
19 | /** | |
20 | * Constants used by the GCM library. | |
21 | */ | |
22 | public final class GCMConstants { | |
23 | ||
24 | /** | |
25 | * Intent sent to GCM to register the application. | |
26 | */ | |
27 | public static final String INTENT_TO_GCM_REGISTRATION = | |
28 | "com.google.android.c2dm.intent.REGISTER"; | |
29 | ||
30 | /** | |
31 | * Intent sent to GCM to unregister the application. | |
32 | */ | |
33 | public static final String INTENT_TO_GCM_UNREGISTRATION = | |
34 | "com.google.android.c2dm.intent.UNREGISTER"; | |
35 | ||
36 | /** | |
37 | * Intent sent by GCM indicating with the result of a registration request. | |
38 | */ | |
39 | public static final String INTENT_FROM_GCM_REGISTRATION_CALLBACK = | |
40 | "com.google.android.c2dm.intent.REGISTRATION"; | |
41 | ||
42 | /** | |
43 | * Intent used by the GCM library to indicate that the registration call | |
44 | * should be retried. | |
45 | */ | |
46 | public static final String INTENT_FROM_GCM_LIBRARY_RETRY = | |
47 | "com.google.android.gcm.intent.RETRY"; | |
48 | ||
49 | /** | |
50 | * Intent sent by GCM containing a message. | |
51 | */ | |
52 | public static final String INTENT_FROM_GCM_MESSAGE = | |
53 | "com.google.android.c2dm.intent.RECEIVE"; | |
54 | ||
55 | /** | |
56 | * Extra used on {@link #INTENT_TO_GCM_REGISTRATION} to indicate the sender | |
57 | * account (a Google email) that owns the application. | |
58 | */ | |
59 | public static final String EXTRA_SENDER = "sender"; | |
60 | ||
61 | /** | |
62 | * Extra used on {@link #INTENT_TO_GCM_REGISTRATION} to get the application | |
63 | * id. | |
64 | */ | |
65 | public static final String EXTRA_APPLICATION_PENDING_INTENT = "app"; | |
66 | ||
67 | /** | |
68 | * Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate | |
69 | * that the application has been unregistered. | |
70 | */ | |
71 | public static final String EXTRA_UNREGISTERED = "unregistered"; | |
72 | ||
73 | /** | |
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. | |
77 | */ | |
78 | public static final String EXTRA_ERROR = "error"; | |
79 | ||
80 | /** | |
81 | * Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate | |
82 | * the registration id when the registration succeeds. | |
83 | */ | |
84 | public static final String EXTRA_REGISTRATION_ID = "registration_id"; | |
85 | ||
86 | /** | |
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. | |
90 | */ | |
91 | public static final String EXTRA_SPECIAL_MESSAGE = "message_type"; | |
92 | ||
93 | /** | |
94 | * Special message indicating the server deleted the pending messages. | |
95 | */ | |
96 | public static final String VALUE_DELETED_MESSAGES = "deleted_messages"; | |
97 | ||
98 | /** | |
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} | |
102 | */ | |
103 | public static final String EXTRA_TOTAL_DELETED = "total_deleted"; | |
104 | ||
105 | /** | |
106 | * Permission necessary to receive GCM intents. | |
107 | */ | |
108 | public static final String PERMISSION_GCM_INTENTS = | |
109 | "com.google.android.c2dm.permission.SEND"; | |
110 | ||
111 | /** | |
112 | * @see GCMBroadcastReceiver | |
113 | */ | |
114 | public static final String DEFAULT_INTENT_SERVICE_CLASS_NAME = | |
115 | ".GCMIntentService"; | |
116 | ||
117 | /** | |
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. | |
121 | */ | |
122 | public static final String ERROR_SERVICE_NOT_AVAILABLE = | |
123 | "SERVICE_NOT_AVAILABLE"; | |
124 | ||
125 | /** | |
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. | |
128 | */ | |
129 | public static final String ERROR_ACCOUNT_MISSING = | |
130 | "ACCOUNT_MISSING"; | |
131 | ||
132 | /** | |
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. | |
135 | */ | |
136 | public static final String ERROR_AUTHENTICATION_FAILED = | |
137 | "AUTHENTICATION_FAILED"; | |
138 | ||
139 | /** | |
140 | * The request sent by the phone does not contain the expected parameters. | |
141 | * This phone doesn't currently support GCM. | |
142 | */ | |
143 | public static final String ERROR_INVALID_PARAMETERS = | |
144 | "INVALID_PARAMETERS"; | |
145 | /** | |
146 | * The sender account is not recognized. Fix on the device side. | |
147 | */ | |
148 | public static final String ERROR_INVALID_SENDER = | |
149 | "INVALID_SENDER"; | |
150 | ||
151 | /** | |
152 | * Incorrect phone registration with Google. This phone doesn't currently | |
153 | * support GCM. | |
154 | */ | |
155 | public static final String ERROR_PHONE_REGISTRATION_ERROR = | |
156 | "PHONE_REGISTRATION_ERROR"; | |
157 | ||
158 | private GCMConstants() { | |
159 | throw new UnsupportedOperationException(); | |
160 | } | |
161 | } |