diff --git a/Parse/src/main/java/com/parse/GcmRegistrar.java b/Parse/src/main/java/com/parse/GcmRegistrar.java index d4234a0b1..db7c44d30 100644 --- a/Parse/src/main/java/com/parse/GcmRegistrar.java +++ b/Parse/src/main/java/com/parse/GcmRegistrar.java @@ -38,8 +38,6 @@ private static final String REGISTRATION_ID_EXTRA = "registration_id"; private static final String ERROR_EXTRA = "error"; - // Client-side key for parseplatform@gmail.com. See parse/config/gcm.yml for server-side key. - private static final String PARSE_SENDER_ID = "1076345567071"; private static final String SENDER_ID_EXTRA = "com.parse.push.gcm_sender_id"; public static final String REGISTER_ACTION = "com.google.android.c2dm.intent.REGISTER"; @@ -134,24 +132,33 @@ private Task sendRegistrationRequestAsync() { // a 32-bit integer. For `android:value="567327206255"`, this returns a truncated integer // because 567327206255 is larger than the largest 32-bit integer. Bundle metaData = ManifestInfo.getApplicationMetadata(context); - String senderIDs = PARSE_SENDER_ID; + String senderID = null; + if (metaData != null) { Object senderIDExtra = metaData.get(SENDER_ID_EXTRA); if (senderIDExtra != null) { - String senderID = actualSenderIDFromExtra(senderIDExtra); + senderID = actualSenderIDFromExtra(senderIDExtra); - if (senderID != null) { - senderIDs += ("," + senderID); - } else { + if (senderID == null) { PLog.e(TAG, "Found " + SENDER_ID_EXTRA + " element with value \"" + senderIDExtra.toString() + "\", but the value is missing the expected \"id:\" " + "prefix."); + return null; } } } - request = Request.createAndSend(context, senderIDs); + if (senderID == null) { + PLog.e(TAG, "You must provide " + SENDER_ID_EXTRA + " in your AndroidManifest.xml\n" + + "Make sure to prefix with the value with id:\n\n" + + "\" />"); + return null; + } + + request = Request.createAndSend(context, senderID); return request.getTask().continueWith(new Continuation() { @Override public Void then(Task task) {