Firebase message (FCM) not work in close app - ios

This Post is referenced by FCM.
If the application is active state or in background state then all is well it's working fine.
But if you close(Terminate) the application. The messages do not come, that I would not do it.
Priority is high in messages.
Messages like :
act = msg;
aps = {
"content-available" = 1;
};
"chat_id" = 26;
date = "2016-08-23 08:05:21";
delay = 300;
"from_user" = 25;
"gcm.message_id" = "0:1471939....f965049af";
id = 898;
"is_read" = 0;
msg = sds;
type = 1;
How to make that message come close application?

Just ran many tests. It appears that in order to have the message delivered to a "closed" IOS app, you need to specific priority=high. With priority unspecified or set to "normal" it will not deliver the notification to a closed app. When the app restarts, it seems the undelivered messages will be sent and handled in the same way as if the app were in the foreground when they were sent originally.

Related

react native push notification not display when app in background on ios

I have react native application until now I used react-native-firebase version 5.5.6 (https://www.npmjs.com/package/react-native-firebase/v/5.5.6) to recived push notification and every work fine in android and ios.
now i upgrade to react-native-firebase version 11.1.2 and react-native-firebase/messaging version 11.1.2.
in android the notification work fine in all app state (foreground, background, closed)
in ios when app in foreground the notification recived fine but in in background or closed app the notification not showing
I mark the remote notification and fetch notification in background modes in xcode
when the in foreground and i received notification this is json i received
{
aps = {
alert = {
body = "\nCat. No.: 34612\nAddress: \U05d1\U05e0\U05d9\U05d9\U05df \U05e2\U05d9\U05e8\U05d9\U05d9\U05d4 \U05d1\nFloor: 2\nReported about: Intercoms \nStatus: Your call has been received\n Description: check\n Full name: \U05d2\U05dc\U05d7\U05d1\U05d7 \U05dc\U05d1\U05d9\U05d0\U05d7\U05d2\U05d7";
title = "New message about a service call";
};
badge = 2;
"content-available" = 1;
"mutable-content" = 1;
};
"custom_notification" = "{\"title\":\"New message about a service call\",\"body\":\"\\nCat. No.: 34612\\nAddress: \U05d1\U05e0\U05d9\U05d9\U05df \U05e2\U05d9\U05e8\U05d9\U05d9\U05d4 \U05d1\\nFloor: 2\\nReported about: Intercoms \\nStatus: Your call has been received\\n Description: check\\n Full name: \U05d2\U05dc\U05d7\U05d1\U05d7 \U05dc\U05d1\U05d9\U05d0\U05d7\U05d2\U05d7\",\"show_in_foreground\":true,\"icon\":\"push_notification\",\"sound\":\"default\"}";
deepLink = "https://darimpo-test.appspot.com/#openApplication?serviceCallId=34612&taskPostId=151288";
"fcm_options" = {
image = "https://storage.googleapis.com/download/storage/v1/b/darimpo_test_images/o/8551.jpg?generation=1615666155330439&alt=media";
};
"gcm.message_id" = 1616606515037965;
"google.c.a.e" = 1;
"show_in_foreground" = "{\"title\":\"New message about a service call\",\"body\":\"\\nCat. No.: 34612\\nAddress: \U05d1\U05e0\U05d9\U05d9\U05df \U05e2\U05d9\U05e8\U05d9\U05d9\U05d4 \U05d1\\nFloor: 2\\nReported about: Intercoms \\nStatus: Your call has been received\\n Description: check\\n Full name: \U05d2\U05dc\U05d7\U05d1\U05d7 \U05dc\U05d1\U05d9\U05d0\U05d7\U05d2\U05d7\",\"show_in_foreground\":true,\"icon\":\"push_notification\",\"sound\":\"default\"}";
}
maybe you now why is not working for me
thank you

ios 13 push-notification gets cleared as soon as we get when device is locked

when I'm receiving push notification on iOS 13, and device is locked. I' getting pushnotifcation, but it gets cleared immediately without any user interaction.
I'm using .net and following is payload code which I'm using
{to = notification.DeviceToken,
priority = "high",
content_available = true,
notification = new
{
body = notification.Message, //This will be a subtitle..
title = notification.Name, //This will be a title..
},
data = new
{
notificationId = notification.NotificationId,
userId = notification.UserId,
encryptedNotification = Crypto.Encrypt("id", notification.NotificationId.ToString())
}
};
string postbody = JsonConvert.SerializeObject(payload).ToString();
Byte[] byteArray = Encoding.UTF8.GetBytes(postbody);
tRequest.ContentLength = byteArray.Length;
**tRequest.Headers.Add("apns-push-type", "alert");**
**tRequest.Headers.Add("apns-priority", "5");**
}```
Please guide me what wrong in code.
have referred following azure code to implement, but not able to find the cause.
https://learn.microsoft.com/en-us/azure/notification-hubs/push-notification-updates-ios-13
This can happen if you have a code that decreases the app icon's notification badge number. If you do that, make sure you do it only if the application is active. If it is inactive and you decrease the badge number, it might cause the notification to appear and immediately disappear.

Xamarin IOS Push Killed app

Push =>
{{
aps = {
alert = {
"loc-args" = (
);
"loc-key" = "new_chat";
};
"content-available" = 1;
id = 3;
message = Aaa;
sound = default;
subject = "new_chat";
type = chat;
};
}}
When the application is killed and I receive a push notification it is shown with the text "new_chat". How can I change it to another text?
Assuming you are targeting iOS 10+, you can add a Notification Services extension app (UNNotificationServiceExtension) to your app bundle.
modifies the content of a remote notification before it is delivered to the user.
In the DidReceiveNotificationRequest override, extract your content from the UNNotificationRequest and modify it and return it via the contentHandler provided.
Required reading to understand how/when the extension is used:
Modifying Content in Newly Delivered Notifications
Also:
Xamarin Docs: iOS Extensions in Xamarin.iOS
Apple docs: UNNotificationServiceExtension

Push notification is not showing 2kb in ios 9

Check this following push notification response. I have passed longer text in the "alert", but it is cut to "Riddham Pan". It exceeds the limit of payload.
Can any one please tell me how they counted 256 bytes in the following notification.
I am checking in ios 9 so limit should be 2kb. Do I have to do any custom settings in code for getting the notification upto 2kb length?
{
EmailID = "";
Message = "";
NotificationType = Offline;
RefId = 0;
RefType = "3f588d5b-dbbd-4a65-b800-d863f8eb684d#conference.dev.time.appleapps.in";
UserName = New1;
aps = {
alert = "Riddham Pan";
badge = 2;
"content-available" = 1;
sound = "sms-received5.caf";
};
}
Thanks in advance.
The JSON is invalid. If payload limit exceeds than 2kb notification would not be handled. From Apple docs
Apple Push Notification service refuses any notification that exceeds this limit.
Reference
Since you are receiving notifications this means your payload limit is not exceeding but JSON format is invalid.

APN custom notification sound issue

I have remote notifications setup and working fine. I however have to play a custom sound when a notification is received (when app is NOT in foreground). I have added a file called customSound.wav to my app bundle and made sure "add to targets" is selected when i drag and drop it into my project (is this the correct way?). Server-side: the same file name has been specified as "sound": "customSound.wav". In my didReceiveRemoteNotification i am printing the userInfo dictionary and it is coming up like this:
aps =
{
alert = "Good Evening Sir";
badge = 1;
"custom_filed1" = 1;
"custom_field2" = "AAA-BBB-CCC";
name = "Sir Hubert";
sound = default;
};
As you can see, sound is still "default". I am aware of the fact that if the sound specified can not be found, the default sound is played- will the sound value in the dictionary also be "default" or it should be the file name that was specified in payload json. Is the order in which these are specified in the payload important. I have tried suggestions from other threads but not working for me. I can not show the json as I do not have access to the system at the moment. Any suggestions as to what I may be doing wrong ?
No your sound key should have the sound file name you want to play.
{
aps =
{
alert = "message";
sound = "sound file name.extension";
badge = 1;
};
}
eg:
{
aps =
{
alert = "message";
sound = "tone.caf";
};
}
I am using this and getting successful custom alert on my notification;
keep sound duration as small as possible. I did with this file format: aiff, caf
if u want to test notification then u can try this app https://itunes.apple.com/us/app/easy-apns-provider-push-notification/id989622350?mt=12
I am not doing any marking of this app but it is good for testing push notification

Resources