public static int NOTIFICATION_ID = 1;
private void sendNotification(Bundle bundle) {
NOTIFICATION_ID++;
NotificationManager mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(this, MessageActivity.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
int defaults = Notification.DEFAULT_ALL;
final String def = bundle.getString("defaults") ;
if (def != null) {
try {
defaults = Integer.parseInt(def);
} catch (NumberFormatException e) {}
}
Log.d(TAG," NOTIFICATION_ID ====["+NOTIFICATION_ID+"]");
Log.d(TAG," DEFAULT VALUE ====["+defaults+"]");
notificationIntent.putExtra(Config.CONTENTS_KEY, bundle.getString(Config.CONTENTS_KEY));
PendingIntent contentIntent = PendingIntent.getActivity(this, NOTIFICATION_ID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.icon)
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setWhen(System.currentTimeMillis())
.setContentTitle(title)
.setTicker(title)
.setDefaults(defaults)
.setAutoCancel(true).setContentText(msg);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}