In the last release of FuseLibs and uno (1.13) when I click on a push notification the receivedMessage
don’t trigger when the app is open. This worked in previous version but now its imposible to excute some action when I click in a notification.
I test it on Android…
aeq
December 10, 2019, 8:54am
2
If 1.13 included the AndroidX support, then you would need to upgrade all the dependencies to use AndroidX libraries like so: https://github.com/fuse-open/fuselibs/pull/1318/files
AndroidX PRs:
fuse-open:master
← rbtech:AndroidX-Support
opened 08:33PM - 11 Nov 19 UTC
fuse-open:master
← rbtech:AndroidX-Support
opened 08:34PM - 11 Nov 19 UTC
fuse-open:master
← rbtech:Push-Notifications
opened 12:58PM - 31 Oct 19 UTC
But @aeq this solve the onMessageReceived
? My push work fine but the only problem, I think in iOS also happen, is when I click a push notification with the app closed or in background and the receivedMessage
don’t trigger.
I really need to open the notification section in many apps when I click the notification when the app is closed or in background… I have many apps with this error and this worked fine in previous versions…
aeq
December 11, 2019, 10:41am
5
Which push notification module are you using?
aeq
December 12, 2019, 8:31am
7
Ok, I’m gonna do tests with latest everything…
aeq
December 12, 2019, 8:40am
8
I just tested for iOS and can confirm:
registration succeeded
payload was received via receivedMessage
when app is open
when app is closed
when app is “minimised” or in background
aeq
December 12, 2019, 9:08am
9
I just tested for Android and can confirm:
registration succeeded
payload was received via receivedMessage
when app is open
when app is closed
when app is “minimised” or in background
aeq
December 12, 2019, 9:12am
10
Latest fuselibs now has AndroidX Support merged:
committed 03:45PM - 11 Dec 19 UTC
AndroidX Support - Requires corresponding Uno PR
There is still an android push notification update PR:
fuse-open:master
← rbtech:Push-Notifications
opened 12:58PM - 31 Oct 19 UTC
Tested now in a separarate app with Uno Canary and the Fuselibs you send me. On iOS work perfect but on Android dont trigger receivedMessage
when the app is in background or closed and I click the notification from the topbar.
Tested on a Samsung Note 10+
, Huawei p30 pro
with Android 9, Samsung S4
with Android 5.0.1 and doesn’t work!
aeq
December 16, 2019, 1:03pm
12
I tested on Samsung Galaxy Note10+ and Samsung Galaxy Tab S4, both worked with Android 9.
I updated the PR to include the latest master but I don’t think that’s the issue: https://github.com/fuse-open/fuselibs/pull/1318
aeq
December 16, 2019, 1:35pm
13
Tested with master fuselibs and uno repos + PR: https://github.com/fuse-open/fuselibs/pull/1318
I try all and doesn’t work
Now I try with:
"dependencies": {
"@fuse-open/fuselibs": "^1.14.0-canary.0",
"@fuse-open/uno": "^1.14.0-canary.1",
"android-build-tools": "^1.3.0-canary.0"
}
And don’t work
I follow the instructions but the same problem
I receive the push perfect on my device. If I have the app open and a notification arrives the receivedMessage
function execute fine. But if my app is in background, the push arrives but if I click on it, the app opens but the receivedMessage
don’t trigger…
Here is a video to demostrate my problem: video.zip (4.1 MB)
My MainView:
<App>
<JavaScript>
var Push = require("FuseJS/Push");
var vibration = require('FuseJS/Vibration');
var Observable = require("FuseJS/Observable");
var Message = Observable("-");
Push.on("registrationSucceeded", function(regID) {
console.log("registrationSucceeded_____________________________________________________________________________________");
console.log(regID)
});
Push.on("error", function(reason) {
console.log("Error_____________________________________________________________________________________");
console.log(reason);
});
Push.on("receivedMessage", function(payload) {
console.log("receivedMessage_____________________________________________________________________________________");
Message.value = "Received!!!!";
setTimeout(function() {
Message.value = "-";
}, 3000);
vibration.vibrate(1);
});
module.exports = {
Message: Message,
};
</JavaScript>
<Text Value="{Message}" TextAlignment="Center" Color="#000" FontSize="50" Alignment="VerticalCenter" />
</App>
My .unoproj:
{
"Title": "test",
"RootNamespace":"test",
"Version": "3.23",
"VersionCount": 323,
"Mobile": {
"Orientations": "Portrait"
},
"Packages": [
"Fuse",
"FuseJS",
"Fuse.PushNotifications",
"Fuse.Vibration"
],
"Android": {
"WindowIsTranslucent" : false,
"UsesCleartextTraffic": true,
"GooglePlay": {
"SenderID": "xxxxxx"
},
"Package": "xxxxx"
},
"Includes": [
"*"
]
}
Solved. For some strange reason don’t work when I send the push with the notification
and data
in the same message like:
fetch('https://fcm.googleapis.com/fcm/send', {
'method': 'POST',
'headers': {
'Authorization': 'key=xxxx',
'Content-Type': 'application/json'
},
'body': JSON.stringify({
'notification': notification,
'data': payload,
"priority":"high",
"content_available": true,
'to': to
})
}).then(function(response) {
}).catch(function(error) {
});
But if I send one with the notification and other with the data work perfect!
fetch('https://fcm.googleapis.com/fcm/send', {
'method': 'POST',
'headers': {
'Authorization': 'key=xxxx',
'Content-Type': 'application/json'
},
'body': JSON.stringify({
'data': payload,
"priority":"high",
"content_available": true,
'to': to
})
}).then(function(response) {
}).catch(function(error) {
});
fetch('https://fcm.googleapis.com/fcm/send', {
'method': 'POST',
'headers': {
'Authorization': 'key=xxxx',
'Content-Type': 'application/json'
},
'body': JSON.stringify({
'notification': notification,
"priority":"high",
"content_available": true,
'to': to
})
}).then(function(response) {
}).catch(function(error) {
});
aeq
January 22, 2020, 8:54am
18
I think it has to do with the format around “data”, this is how I sent mine in a test that works:
fetch('https://fcm.googleapis.com/fcm/send', {
method: 'post',
headers: {
'Authorization': 'key=' + API_ACCESS_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
registration_ids: [regID.value],
data: {
notification: {
alert: {
title: 'Well would ya look at that!',
body: 'Hello there'
}
},
payload: 'anything you like'
}
})
}).then(function(response) {
console.log(JSON.stringify(response));
}, function(error) {
console.log(error);
});