title: Display FCM notification message in Listview onClicking Notification
body: <p>I have successfully sent Firebase notifications using my own server to Android app and I want to listing the messages in a ListView in a new activity by clicking the notification. what i shoud do to notification messages are getting displayed in ListView , I want to help complete this work.</p>
  
  <p>FirebaseMessageservice.java:</p>
  
  <pre><code>    public class FcmMessagingService extends FirebaseMessagingService {
      private Map&lt;String, String&gt; data;
      private static final String TAG="MyFirebaseMsgService";
      @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
          super.onMessageReceived(remoteMessage);
          data=remoteMessage.getData();
          String message=data.get("message");
          String titledata=data.get("title");
          ManualNotification(titledata , message);
  
          Set&lt;String&gt; noti_set = PreferenceManager.getDefaultSharedPreferences(context).getStringSet("noti_set", new HashSet&lt;String&gt;());
          Set&lt;String&gt; set = new HashSet&lt;String&gt;();
          set.add(titledata+"---"+message);
          set.addAll(noti_set);
          PreferenceManager.getDefaultSharedPreferences(context).edit().putStringSet("noti_set", set).apply();
  
      }
  private void ManualNotification(String title , String messageBody){
          Intent intent = new Intent(this, MainActivity.class);
          Bundle bundle = new Bundle();
          bundle.putString("message", messageBody);
          intent.putExtras(bundle);
          intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
          Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
          long[] vv = {500,1000};
          Bitmap bmp = BitmapFactory.decodeResource(this.getResources(),R.mipmap.ic_launcher);
          Notification.BigPictureStyle bigpicture = new Notification.BigPictureStyle();
          bigpicture.bigPicture(bmp);
          NotificationCompat.Builder notificationBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this)
                  .setSmallIcon(R.mipmap.ic_launcher)
                  .setContentTitle(title)
                  .setContentText(messageBody)
                  .setAutoCancel(true)
                  .setLargeIcon(bmp)
                  .setSound(defaultSoundUri)
                  .setVibrate(vv)
                  .setContentIntent(pendingIntent);
          NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          notificationManager.notify(0, notificationBuilder.build());
      }
  }
  </code></pre>
  
  <p>FcmInstanceIdService.java:</p>
  
  <pre><code>  public class FcmInstanceIdService extends FirebaseInstanceIdService {
  private static final String REG_TOKEN = "REG_TOKEN";
  @Override
  public void onTokenRefresh() {
      String recent_token= FirebaseInstanceId.getInstance().getToken();
      SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences("FCM_TOKEN", Context.MODE_PRIVATE);
      SharedPreferences.Editor editor = sharedPreferences.edit();
      editor.putString("FCM_TOKEN",recent_token);
      editor.apply();
      Log.d(REG_TOKEN,recent_token);
  }
  </code></pre>
  
  <p>lst.java:</p>
  
  <pre><code>   public class lst {
  private String title;
  private String message;
  
  public lst() {
  }
  
  public lst(String title, String message) {
      this.title = title;
      this.message = message;
  }
  
  public String getTitle() {
      return title;
  }
  
  public void setTitle(String title) {
      this.title = title;
  }
  
  public String getmessage() {
      return message;
  }
  
  public void setMessage(String message) {
      this.message = message;
  }
  </code></pre>
  
  <p>}
  Messages.java:</p>
  
  <pre><code>  public class Messages extends AppCompatActivity {
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_list);
  
      Set&lt;String&gt; noti_set = PreferenceManager.getDefaultSharedPreferences(context).getStringSet("noti_set", new HashSet&lt;String&gt;());
      for (String noti : noti_set){
              String title = noti.splite("---")[0];
              String message = noti.splite("---")[1];
              list.add(new lst(title,message));
              adapter.notifyDataSetChanged();
      }
  
  }
  </code></pre>
  
  <p>}</p>