private void sendNotification(String msg, int currentFeelingNumber) {
mNotificationManager = (NotificationManager) this
.getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP));
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,intent, 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.bg_splash)
.setContentTitle("GCM Notification")
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setContentText(msg);
mBuilder.setContentIntent(contentIntent);
Notification notification = mBuilder.build();
// Hide the notification after its selected
notification.flags |= Notification.FLAG_AUTO_CANCEL;
//adding LED lights to notification
notification.defaults |= Notification.DEFAULT_ALL;
mNotificationManager.notify(NOTIFICATION_ID,notification);
}
|