Thu. Dec 2nd, 2021
Where is the Android SDK folder located?

I’ve a difficulty with firebase cloud messaging notification. I’ve carried out operate that sends particular title, message and imageUrl and I made certain that the image measurement is lower than 1mb as the documentation. But sometimes I see the image and sometime I do not see the image in the notification

and once I debug to verify the notification object, it accommodates the imageUrl.

Here is my Implementation:

const notification = {
    title: knowledge.title,
    physique: knowledge.message,
    ...(imageUrl && { imageUrl }),
  };

exports.notificationWithImg = async (registrationToken, notification) => {
  attempt {
    const response = await admin.messaging().sendMulticast({
      tokens: registrationToken,
      notification,
    });
    console.log("Notificatin response:", JSON.stringify(response));
    if (response.successCount > 0) {
      return {
        statusMessage: "SUCCESS",
        message: "Sent Successfully",
        statusCode: 200,
      };
    }
    if (response.failureCount > 0) {
      return {
        statusMessage: "ERROR",
        message: "Falure",
        statusCode: 400,
      };
    }
  } catch (error) {
    console.log("Error", error);
    return {
      statusMessage: "ERROR",
      message: "SERVER ERROR",
      statusCode: 400,
    };
  }
};

By admin