diff --git a/parse/src/main/java/com/parse/ParsePushBroadcastReceiver.java b/parse/src/main/java/com/parse/ParsePushBroadcastReceiver.java index be14a83a8..6b108b72b 100644 --- a/parse/src/main/java/com/parse/ParsePushBroadcastReceiver.java +++ b/parse/src/main/java/com/parse/ParsePushBroadcastReceiver.java @@ -21,6 +21,7 @@ import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.support.annotation.Nullable; import android.support.v4.app.NotificationCompat; import org.json.JSONException; @@ -171,7 +172,12 @@ protected void onPushReceive(Context context, Intent intent) { context.sendBroadcast(broadcastIntent); } - Notification notification = getNotification(context, intent).build(); + final NotificationCompat.Builder notificationBuilder = getNotification(context, intent); + + Notification notification = null; + if (notificationBuilder != null) { + notification = notificationBuilder.build(); + } if (notification != null) { ParseNotificationManager.getInstance().showNotification(context, notification); @@ -383,6 +389,7 @@ protected Intent getDeleteIntent(Bundle extras, String packageName) { * @return The notification builder to be displayed. * @see ParsePushBroadcastReceiver#onPushReceive(Context, Intent) */ + @Nullable protected NotificationCompat.Builder getNotification(Context context, Intent intent) { JSONObject pushData = getPushData(intent); if (pushData == null || (!pushData.has("alert") && !pushData.has("title"))) {