Firebase Push Notifications with images


I am trying to do a push notification with images but not sure what i am doing wrong below is what i did …

var app = “tns-core-modules/application”;
var platform = “tns-core-modules/platform”;
var ImageModule = (“tns-core-modules/ui/image”);
const application = require(“application”);
const imageSource = require(“image-source”);
var dialogs = require(“ui/dialogs”);
var firebase = require(“nativescript-plugin-firebase”);
var utils = require(“utils/utils”);

var context =; // get a reference to the application context in Android

function callback(message) {

var title = message.title;
var message = message.body;
var img_url = message.img;
var soundUri =;
var mainIntent = new android.content.Intent(context, com.tns.NativeScriptActivity.class);


var pendingIntent =, 0, mainIntent,;

var builder = new;

    .then(function (res) {
      //console.log("Image successfully loaded");


        var manager = context.getSystemService(android.content.Context.NOTIFICATION_SERVICE);

    }, function (error) {
        //console.log("Error loading image: " + error);


var initObject = {
onMessageReceivedCallback: callback

.then(function (instance) {
console.log(“firebase.init done”);
}, function (error) {
console.log("firebase.init error: " + error);

application.start({ moduleName: “login-page/login” });

How to send Image through firebase
Settings of push notifications via Firebase Cloud Messaging (No sound, led light, badge, vibration)

@shady I just had a deep look in the docs, what you are doing should work if you have declared the custom messaging service in your manifest.


You’ll have to send a notification which only contains the data.
(else it will get displayed automatically)

Then you could use something like local-notifications plugin to create your notification with images.

It is easier to send notifications with images in one signal notification plugin.

But i would recommend the firebase way.