toBundle

open fun toBundle(): Bundle

Converts this push message to a Bundle.

Returns the raw push payload as an Android Bundle containing all the notification data received from FCM/HMS. This is useful when you need to access fields that don't have dedicated getter methods or when passing the push data to other components. Example:


  
  protected void onMessageOpened(PushMessage message) {
      // Get raw bundle for advanced processing
      Bundle bundle = message.toBundle();

      // Access all bundle keys
      for (String key : bundle.keySet()) {
          Log.d("App", "Key: " + key + " = " + bundle.get(key));
      }

      // Pass to analytics service
      analytics.trackNotificationOpened(bundle);

      // Store for later processing
      SharedPreferences prefs = getSharedPreferences("app", MODE_PRIVATE);
      prefs.edit()
          .putString("last_notification", bundle.toString())
          .apply();
  }

Return

Bundle containing the complete push notification payload

See also