Push Notifications doesn't work on fuse preview

When trying to config Push Notifications on my app I get no console.log message from registrationSucceeded or error, I’m running on view, not on real android device or emulator.

Here is my code

Here is uno fileCapturess

Yes, that is because you need a real device to test push notifications.

Thank you, but console.log doesn’t print anything ?

Yeah, on Android Oreo+, the console.logs are not working on terminal for an export, I think it works for an exported preview but I haven’t tested push that way to say, its something that needs to be looked into but you can use the interface to see your data in the meantime, here’s my basic test app UX you can use:

<App Background="#18f">
    var Push = require("FuseJS/Push");
		var Observable = require("FuseJS/Observable");

		var status = Observable("-");
		var message = Observable("-no message yet-");
		Push.on("registrationSucceeded", function(regID) {
		    console.log("Reg Succeeded: " + regID);
		    status.value = "Success: " + regID;
		Push.on("error", function(reason) {
		// Push.onRegistrationFailed = function(reason) {
		    console.log ("Reg Failed: " + reason);
		    status.value = "Failed: " + reason;

		Push.on("receivedMessage", function(payload, fromNotificationBar) {
		// Push.onReceivedMessage = function(payload, fromNotificationBar) {
		    console.log("Recieved Push Notification: " + payload);
		    payloadData = JSON.parse(payload);
		    message.value = payload;

		var clearBadgeNumber = function() {

		var clearAllNotifications = function() {

		module.exports = {
		    message: message,
		    status: status,

		    clearBadgeNumber: clearBadgeNumber,
		    clearAllNotifications: clearAllNotifications,

		<StackPanel Dock="Top" Background="#18f">
			<Fuse.iOS.StatusBarConfig Style="Light"/>

			<StackPanel Width="92%" Padding="20">
				<Text Value="Notifications Test" Alignment="Center" FontSize="25" TextColor="#18f" TextWrapping="Wrap"/>

				<Button Padding="10" Clicked="{clearBadgeNumber}" Text="Clear Badge Number"/>
				<Button Padding="10" Clicked="{clearAllNotifications}" Text="Clear All Notifications"/>

				<Text Alignment="Left" Value="Status"/>
				<Text Alignment="Left" Value="{status}" TextWrapping="Wrap"/>
				<Text Alignment="Left" Value="{message}" TextWrapping="Wrap"/>

				<Rectangle Layer="Background" CornerRadius="9" Color="#fff"/>

		<BottomBarBackground Dock="Bottom" />

Btw, the current push notifications that comes with fuse uses the old GCM way of receiving push notifications which will end in April and you won’t be able to receive notifications on newer androids because you need to specify a channel. I’ve got an updated version of push that uses FCM here and has default settings: https://github.com/fuse-open/fuselibs/pull/1220

I tested on real device and the regID is printed on the text filed but when i send notification from Fire-base the notification doesn’t appear on the device.

That will be due to the payload structure sent, here’s the format that needs to be sent at a minimum:

priority: 'high',
data: {
    notification: {
        alert: {
            title: 'There is something cool to look at',
            body: 'Hello World!'
    payload: 'anything you like'

You can find examples of the other features I added here: https://github.com/fuse-open/fuselibs/blob/1792c481f3b7b7758a03060910b50978c6d35929/Source/Fuse.PushNotifications/Docs/Guide.md#additional-android-push-notification-features

Okay thank for that, but i didn’t understand you correctly, i’m sending the notification form Fir-base Console so where this code should be written? in the console i just fill the filed of the message and Fire-base send the message.

Yeah, you can’t just use the console as it has its own fixed payload structure, you would need to use your own server, see the How does it work? section of Googles firebase cloud messaging, we’re basically talking about the “Trusted Environment”.

I found an easy site/tool for testing: http://pushtry.com

If you don’t want to give your credentials, even though they’re dev, then you could use something like a Node.js module to test from your machine: https://www.npmjs.com/package/fcm-node

Thank you @aeq okay that is good, the notification worked in the app, but the notification didn’t appeared on device notifications bar. image.
Screenshot from mobile app


That’s cos you have the app open, you gotta minimize or close the app now before sending the push.

Okay that is working good, only the notification appear if app is minimized if i closed the app the notification doesn’t appeared!

I just ran tests on old and new androids and they’re working…

While the app was closed:

  • Did you pull down your notification bar to see if its there?

  • Did you tap your power off, to see the notification appear in the lock screen?

How did you check because sound is not on by default for instance, that’s an option you need to set in the payload.

Blockquote Did you pull down your notification bar to see if its there?

Only if the app is minimized

Did you tap your power off, to see the notification appear in the lock screen?

Yes I did

I did all these stuff, i tried to send notification when the app is minimized and it’s working and showed in the notification bar, but when i close the application the notification doesn’t appear in the notification bar,

Oh, I just checked your payload again, you’re missing an outer data attribute like this but if its not this, read further below:

    priority: 'high',
    data: {

        notification: {
            alert: {
                title: "There is something cool to look at",
                body: "Hello World!"
        payload: "anything you like"

It could be that you gotta set the importance level of the notification channel to high importance, the default is set to the “default” value: https://developer.android.com/guide/topics/ui/notifiers/notifications

So like this (I added the notificationPriority for you to experiment with too):

    priority: 'high',
    data: {

        notification: {
            alert: {
                title: "There is something cool to look at",
                body: "Hello World!",
                notificationChannelImportance: "high",
                notificationPriority: "high",
        payload: "anything you like"

Still the same problem,

	        "to": "Device Key",
	              "priority": "high",
	                "data": {

	"notification": {
		"alert": {
			"title": "There is something cool to look at",
			"body": "Hello World!",
			"notificationChannelImportance": "high",
			"notificationPriority": "high",
			"sound": "default"
	"payload": "anything you like"


Do I need to make my application running in the background? or Push notification work fine even if fuse app not running in the background?

No you shouldn’t have to do that…

Did you delete the app before between each change or test? As the push notification settings for an app are fixed after the first push (unless programmatically or manually changed).

If you didn’t delete before testing again, then the app can still be in a lower importance or priority, you can confirm this in the apps push notifications settings.

I take it its working for you now?