Closed saperlipopette45 closed 5 years ago
Hi @saperlipopette45 - what platform are we talking about here? (e.g. iOS has an ocean of tick-boxes and related settings so it might be something related to that!)
i have similar issue in ios,
I can send message from firebase console but not programmatically.
There is no sendMessage function in qfirebasemessaging.h
On 16 Oct 2018, at 12:34, Larpon notifications@github.com wrote:
Hi @saperlipopette45 https://github.com/saperlipopette45 - what platform are we talking about here? (e.g. iOS has an ocean of tick-boxes and related settings so it might be something related to that!)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Larpon/QtFirebase/issues/95#issuecomment-430159609, or mute the thread https://github.com/notifications/unsubscribe-auth/AYKMor9sRS6ZnMEiyXJhHHIXeki5qdBeks5ulaEDgaJpZM4XTd-P.
finally, I could send message form the code after changing send function in Messaging.qml of QtFirebaseExample :
function send() {
var http = new XMLHttpRequest()
var url = "http://blackgrain.dk/php/qtfirebase/"
var params = "device="+messaging.token
http.open("GET", url+"?"+params, true);
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
App.log(http.responseText)
}
}
http.send(null)
}
—————>>> to :
function send() {
var server_key = ‘key=your-server-key'
var http = new XMLHttpRequest()
var url = 'https://fcm.googleapis.com/fcm/send'
http.open("POST", url, true);
http.setRequestHeader( 'Content-Type' , 'application/json' )
http.setRequestHeader( 'Authorization' , server_key )
var message =
{
‘to' : ‘your_FCM_token',
'notification' : {
‘body' : 'This is an FCM notification message !',
'title' : 'FCM Message',
}
}
http.send(JSON.stringify(message));
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
App.log(http.responseText)
}
}
—> However, i receive the message only when, I am out of app, I don’t receive it when I am inside the app <—
On 16 Oct 2018, at 12:34, Larpon notifications@github.com wrote:
Hi @saperlipopette45 https://github.com/saperlipopette45 - what platform are we talking about here? (e.g. iOS has an ocean of tick-boxes and related settings so it might be something related to that!)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Larpon/QtFirebase/issues/95#issuecomment-430159609, or mute the thread https://github.com/notifications/unsubscribe-auth/AYKMor9sRS6ZnMEiyXJhHHIXeki5qdBeks5ulaEDgaJpZM4XTd-P.
However, i receive the message only when, I am out of app, I don’t receive it when I am inside the app
Last time I tried QtFirebaseExample messaging I got notifications outside the app - but only messages inside the app - i.e. no notifications when inside the app. I think that's intentional so you can then react on the message as you desire.
It's been a while since I've run full tests on the QtFirebaseExample though
... and yes, use another URL. "http://blackgrain.dk/php/qtfirebase/" is something half done I've been messing with for test purposes
Hello @Larpon , indeed you were right, I totally forfot to check the Push notification Capability in XCode. Sorry for ths issue and thank you ;)
@saperlipopette45 - good to hear you figured it out!
Hello, I made QtFirebaseExample work, and now I'm integrating QtFirebase into my own app, but I have an issue. When I enter my app, I get my FCM token. After quitting my app, I'm sending a notification from FCM console, but nothing is received. But, when I launch back my app, I enter into the callback of received notification. Any idea of why the notification is not displayed ? (I've accepted push notifications when launching the app, and notifications are activated in my settings)
Thank you in advance for any help