Boostr



0 votes
10 views
I had some problem with the firebase notification that does not go through the function while the app is in background while debug. It show different notification style which was not the design i wanted.

I had tried to trace the notification function triggered but i had no clue on it. What i know was when i changed the app icon in android manifi the notification icon will changed also. Please help me.

I want to combine the notification together to make it tidy. Below is my firebase notification code.

public class MyFirebaseMessagingService extends FirebaseMessagingService{

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage){
        Notification.InboxStyle inboxStyle = new Notification.InboxStyle();
        Intent intent = new Intent(this, MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        PendingIntent pendingIntent = PendingIntent.getActivity(this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
        if(remoteMessage.getNotification().getTitle() == null){
            // doing something
        }else if(remoteMessage.getNotification().getTitle().equals("Notification1")){
            // doing something
        }else if(remoteMessage.getNotification().getTitle().equals("Notification2")){
             // doing something
        }else{
            notificationBuilder.setContentTitle("MyNotification");
            notificationBuilder.setContentText(remoteMessage.getNotification().getBody());
            notificationBuilder.setAutoCancel(true);
            notificationBuilder.setSmallIcon(R.drawable.ic_icon);
            inboxStyle.setBigContentTitle("Enter Content Text");
            inboxStyle.addLine("hi events "+value);
            builder.setStyle(inboxStyle);
            notificationBuilder.setContentIntent(pendingIntent);
            NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            notificationManager.notify(0,notificationBuilder.build());

        }

    }
}
asked Dec 7 in ANDROID by Amrendra | 10 views



Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

Related Questions



Welcome to Knowledge Boostr, where you can ask questions and receive answers from other members of the community.
This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

http://boostr.in Q&A for professional and enthusiast programmers http://boostr.in Q&A for professional and enthusiast programmers http://boostr.in Q&A for professional and enthusiast programmers http://boostr.in Q&A for professional and enthusiast programmers


23,471 questions
40,135 answers
12 comments
23,609 users