public class FirebaseMessaging extends FirebaseMessagingService {
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
if (Teliver.isTeliverPush(remoteMessage)) {
Map<String, String> pushData = remoteMessage.getData();
NotificationData data = new GsonBuilder().create().fromJson(pushData.get("description"), NotificationData.class);
if (data.getCommand().equals(TConstants.TELIVER_ASSIGN_TASK)) {
Task task = new GsonBuilder().create().fromJson(data.getPayload(), Task.class);
Intentnt notificationIntent = new Intent(this,ActivityAssignedTask.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManager notificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notBuilder = new NotificationCompat.Builder(this);
notBuilder.setContentIntent(pendingIntent);
notBuilder.setPriority(NotificationCompat.PRIORITY_MAX);
notBuilder.setSmallIcon(R.drawable.ic_notification_icon);
notBuilder.setContentTitle("Task Reminder");
notBuilder.setContentText(getNotifyContent(task.getType()));
notBuilder.setAutoCancel(true);
notBuilder.setOnlyAlertOnce(true);
Notification notification = notBuilder.build();
notification.defaults |= Notification.DEFAULT_SOUND;
notification.flags = Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(7, notification);