|
38 | 38 | private static final String REGISTRATION_ID_EXTRA = "registration_id";
|
39 | 39 | private static final String ERROR_EXTRA = "error";
|
40 | 40 |
|
41 |
| - // Client-side key for [email protected]. See parse/config/gcm.yml for server-side key. |
42 |
| - private static final String PARSE_SENDER_ID = "1076345567071"; |
43 | 41 | private static final String SENDER_ID_EXTRA = "com.parse.push.gcm_sender_id";
|
44 | 42 |
|
45 | 43 | public static final String REGISTER_ACTION = "com.google.android.c2dm.intent.REGISTER";
|
@@ -134,24 +132,33 @@ private Task<Void> sendRegistrationRequestAsync() {
|
134 | 132 | // a 32-bit integer. For `android:value="567327206255"`, this returns a truncated integer
|
135 | 133 | // because 567327206255 is larger than the largest 32-bit integer.
|
136 | 134 | Bundle metaData = ManifestInfo.getApplicationMetadata(context);
|
137 |
| - String senderIDs = PARSE_SENDER_ID; |
| 135 | + String senderID = null; |
| 136 | + |
138 | 137 | if (metaData != null) {
|
139 | 138 | Object senderIDExtra = metaData.get(SENDER_ID_EXTRA);
|
140 | 139 |
|
141 | 140 | if (senderIDExtra != null) {
|
142 |
| - String senderID = actualSenderIDFromExtra(senderIDExtra); |
| 141 | + senderID = actualSenderIDFromExtra(senderIDExtra); |
143 | 142 |
|
144 |
| - if (senderID != null) { |
145 |
| - senderIDs += ("," + senderID); |
146 |
| - } else { |
| 143 | + if (senderID == null) { |
147 | 144 | PLog.e(TAG, "Found " + SENDER_ID_EXTRA + " <meta-data> element with value \"" +
|
148 | 145 | senderIDExtra.toString() + "\", but the value is missing the expected \"id:\" " +
|
149 | 146 | "prefix.");
|
| 147 | + return null; |
150 | 148 | }
|
151 | 149 | }
|
152 | 150 | }
|
153 | 151 |
|
154 |
| - request = Request.createAndSend(context, senderIDs); |
| 152 | + if (senderID == null) { |
| 153 | + PLog.e(TAG, "You must provide " + SENDER_ID_EXTRA + " in your AndroidManifest.xml\n" + |
| 154 | + "Make sure to prefix with the value with id:\n\n" + |
| 155 | + "<meta-data\n" + |
| 156 | + " android:name=\"com.parse.push.gcm_sender_id\"\n" + |
| 157 | + " android:value=\"id:<YOUR_GCM_SENDER_ID>\" />"); |
| 158 | + return null; |
| 159 | + } |
| 160 | + |
| 161 | + request = Request.createAndSend(context, senderID); |
155 | 162 | return request.getTask().continueWith(new Continuation<String, Void>() {
|
156 | 163 | @Override
|
157 | 164 | public Void then(Task<String> task) {
|
|
0 commit comments