Xamarin IOS Push Killed app - ios

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

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.

Gcm ios push notifications in background fail

I can receive push notifications when my app is in foreground but it is not working in background.
When I send the json has this form:
{
"data":{"message":"test ios push notification"},
"time_to_live":604800,
"registration_ids":["key...."],
"collapse_key":"GCM Notifications",
"content_available":1,
"priority":"high"
}
In my application I get in foreground (nothing in background):
{
aps = {
"content-available" = 1;
};
"gcm.message_id" = " whatever ";
message = "test ios push notification";
}
I think that the problem is around content_available but I dont know why I send content_available and the return is content-available. Is this a normal conversion?
SOLVED!
Me bad, I forget to enable it in target -> Capabilities section:

Can't Get GCM Notification from background ios sdk

I can't get GCM notification from background, Although can receive it on foreground such as these:
{
aps = {
alert = {
body = fffff;
title = "\U067e\U06cc\U0627\U0645";
};
badge = 9;
sound = default;
};
"gcm.message_id" = "0:1448218309944532%075c2cd9075c2cd9";
}
Any help?
To get notifications in background, as per apple documentation
"Remote notifications" option needs to be enabled in Background modes under Capabilities in the target settings.
and normally when you receive any notification at that time application:didReceiveRemoteNotification: this method called.
and if you want to call this method in background, then you should sent a silent pushnotification. and for that you have to add content-available key with value 1 into the notification payload.
you JSON response contain that key like below example
{
aps = {
"content-available" : 1,
sound : ""
};
}

Push notification badge not updating in iOS 7.1 when app is closed or in background

{
aps = {
alert = "You have assigned 1 new task.";
badge = 1;
sound = "default"
};
}
The same JSON Payload is working in iOS 8+ but not in 7.1
Am I missing something here in payload?
I have checked for the notification settings and it's fine too.

Resources