Open jakute opened 6 years ago
@jakute it's probably a race condition where the on('notification')
handler is not setup before the push is delivered to the starting app.
Thanks for the reply!! But it the same code for android and for iOS .... but with all the plugin for iOS (cocoa pods and iOS certificate). I don't know what is could be wrong maybe the content-available is not doing his work?. Also I see today that when I send throw the portal of FCM with the parameter content-available=1 it appears the same issue when is in background. Sorry for my English.
Looks like a duplicate of #2266
But I don't use katzer, why is a duplicate? don't understand that. I have tried many things but nothing works it seems like content-available is never process :(
Have you tried to put "content-available" => 1
inside your notification
object? According to the Apple documentation, "content-available" => 1
should be put inside aps
hash
yes I have tried that and the error continues
@jakute when sending via FCM on iOS the payload needs to be a bit different. On iOS we strictly follow the FCM server ref as the code we use to receive the notification comes straight from Google.
So content-available: 1
becomes content_available: true
.
Please try:
$arrayToSend = array(
'registration_ids' => $registrationIds,
"content_available" => false,
"mutable_content" => true,
'priority'=>'high',
'notification'=>array('title' =>$title ,'text' => $message,'vibrate' => 1,'sound' => 1,"notId" => intval($correlativo) )
);
@macdonst we just try that with false like you put it and true... but nothing works the push arrive bu when we click en the push or the app it doesn't show the notification :(
It could well be some formatting issue when sending from FCM to APNS. Can you try to use APNS alone to isolate the issue? It works for me as I'm sending directly via APNS.
++
Hii,
Can anyone please tell me is this issue is resolved?
my Payload:
{ "priority": "high", "to": "dzAlPJvg-oM:APA91bHRNKM-6aHNnPFgDW3zC1ikVxxRJCrs1MVKZx5s3nRW29cXD52DpFsSYlN73wFPBtYppsW-nv-p_-grnpU2kFEDAUjwtUjP_VUrhJEnJPP7KAvCnqIc4polrRo-ZJfCljs9XLXx", "data": { "payload": { "pushType": 7, "title": "Title", "description": "Message", "source": "https://www.google.com.mx/" } }, "notification": { "title": "Title", "body": "Message" } }
initializeFCM() { const options: PushOptions = { android: {}, ios: { alert: 'true', badge: true, sound: 'false' }, windows: {}, browser: { pushServiceURL: 'http://push.api.phonegap.com/v1/push' } }
const pushObject: PushObject = this.push.init(options);
pushObject.on('notification').subscribe((notification: any) => { console.log('Received a notification', notification); if (!notification.additionalData.foreground) { var firstName = notification.additionalData.firstName; var lastName = notification.additionalData.lastName; var modifiedtime = notification.additionalData.modifiedTime; var username = notification.additionalData.userName; if (notification.additionalData.groupId) { var groupId = notification.additionalData.groupId; this.navigateToGroupUserChat(parseInt(groupId)); } else { this.navigateToOneToOneUserChat(firstName, lastName, username, modifiedtime); } } });
pushObject.on('registration').subscribe((registration: any) => { console.log('Device registered', registration); this.registerToken(registration.registrationId); });
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error)); }
I am new in ionic please help me I am stuck in that issue more than 3 weeks kindle help me
Expected Behaviour
When the app is closed and a push arrives the user clicks on the push then the app starts and appears the new notification
Actual Behaviour
When the app is closed and a push arrives the user clicks on the push then the app starts and shows nothing.
Reproduce Scenario (including but not limited to)
It works perfect in android, I use php server to send the push. I tried the FCM page and has the same issue. Today I have tried with "pusher" and still the same issue.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
IOS 9.0 on and IPAD (that doesn't allow iOS 10 :(. )
Cordova CLI version and cordova platform version
Plugin version
Sample Push Data Payload
Sample Code that illustrates the problem
Thanks in advance.