Can I push a Newsstand notification with apn_on_rails? - ios

Is there any way using apn_on_rails to push Newsstand notification? i.e. Push this kind of payload:
{"aps": {"badge": 1,"content-available":"1"} }
At the moment I can see that I can push notification with badge, sound, and alerts.
I'm sure it wouldn't be hard to modify apn_on_rails itself if it turns out it doesn't do it yet. There are so many branches of apn_on_rails, I am using this one at the moment.

The APN::Notification class has a custom_properties property that you use to include any generic data in the push notification. Using your payload as an example, you would do something like this:
apn = APN::Notification.new
apn.badge = 1
apn.custom_properties = {"content-available" => 1}

Grocer also supports Newsstand notifications. https://github.com/grocer/grocer#newsstand-notifications
notification = Grocer::NewsstandNotification.new(device_token: "...")
# Generates a JSON payload like:
# {"aps": {"content-available": 1}}

Related

Are Actionable notifications in iOS only local notifications or they can be sent from the server as well?

Are Actionable notifications in iOS only local notifications, or can they be sent from the server?
I'm interested in adding an actionable notification with two buttons in the app. I read the official documentation and I'm not clear if this type of notification can only be only local notification or if they can be sent from the server as well.
The linked documentation even gives an example of how to do it. So yes, you can create actionable notifications from remote (push) notifications. Just send along the category identifier in the aps dictionary of the notification payload as described in the docs:
{
“aps” : {
“category” : “MEETING_INVITATION”
“alert” : {
“title” : “Weekly Staff Meeting”
“body” : “Every Tuesday at 2pm”
},
},
“MEETING_ID” : “123456789”,
“USER_ID” : “ABCD1234”
}
And then it will show the actions associated to that category.

Emoji does not display in push Notification

I implement the functionality of push Notification in my app. This display text message in push notification but emoji not display. It display ascii code like '\u270c' instead of emoji.
can anyone tell me how to display emoji in push notification
To display Emoji in Push Notification use JSON Decoding at server side. It solves this issue for me
Do this at server side in APNS push notification code and will work like charm
$payload['aps'] = array('alert' => json_decode('"'.$pushMsg['message'].'"'), 'badge' => 0, 'sound' => 'default', 'passcode' => $pushMsg);
You need to change your unicode format to display emoji in push notification and local notification.
Update your unicode as follows:
"\u{270c}"
I hope this will help you.
Reference: https://docs.swift.org/swift-book/LanguageGuide/StringsAndCharacters.html

FCM Cannot recieve notification when app in background react native ios when custom data sent

i have succesfully integrating react-native-fcm and
i am getting notification when i am sending from firebase console (in foreground,background,and killed state of app)
but when i am sending it from our server with custom data i cannot recieved when app is in (killed,background) state
i have also tried content-availble:true in data object
below is the notification data which i am sending
{
aps = {
"content-available" = 1;
};
body = "Get a free T-Shirt #WROGN on every purchase via Shopholix. T&C apply.";
"gcm.message_id" = "0:1475746605785619%9a4a567a9a4a567a";
"gcm.notification.data" = "{\"image\":\"http:\\/\\/res.cloudinary.com\\/saurabh\\/image\\/upload\\/v1469791885\\/media\\/yljgxgmfg1qbulxzwakm.png\",\"user_type\":\"all\",\"screen\":\"store\",\"id\":\"56d7e33ce69f7c8f06550002\",\"title\":\"Shopholix\",\"message\":\"Get a free T-Shirt #WROGN on every purchase via Shopholix. T&C apply.\",\"body\":\"Get a free T-Shirt #WROGN on every purchase via Shopholix. T&C apply.\"}";
"gcm.notification.priority" = high;
id = 56d7e33ce69f7c8f06550002;
image = "http://res.cloudinary.com/saurabh/image/upload/v1469791885/media/yljgxgmfg1qbulxzwakm.png";
message = "Get a free T-Shirt #WROGN on every purchase via Shopholix. T&C apply.";
screen = store;
title = Shopholix;
"user_type" = all;
}
Any help would be appreciated
Thanks,
Your content_available is set to 1. I'm pretty sure when using FCM, you should use true or false. Correct me if I'm reading your payload structure in a wrong way, but are you specifying the content_available separate from the GCM payload?
Also, the priority parameter should be outside the notification payload parameter.
See here for more details.
Were you able to resolve your issue?
Looking at the JSON, if it is exactly how you're sending it, then it is not well formed. All of the keys need to be strings surrounded by quotes. And each key-value pair needs to be comma-separated, not semi-colon.

iOS push notification not received when screen is locked

I am using parse for push notification. Once I receive remote notification I pass it to the local notification, but issue is when screen is locked didReceiveRemoteNotification does not hit. I don't receive any notification.
I am using iOS8
Here's my payload:
{
CommentId = "8082a532-2380-4af5-bb3f-d247cfca519b";
CommentTitle = test; action = "com.lelafe.one4communities.Notifications.NotificationActivity";
aps = { };
moduleIdentifier = 8;
nTitle = "Comment posted by someone";
postingID = "c57a3d27-cfe5-41e9-a311-98a9fd7749ad";
}
There is one more parameter that you need to pass to your payload i.e. content-available and set its value to 1. It needs to be passed in case we wish that our app should receive notifications in the background.
The official documentation of parse describes this parameter as follows:
+content-available: (iOS only) If you are a writing a Newsstand app, or an app using the Remote Notification Background Mode introduced in iOS7 (a.k.a. "Background Push"), set this value to 1 to trigger a background download.
The problem is your dictionary aps:
Try checking out Apple's Documentation about The Notification Payload
Also Quoting #mamills answer:
If there is no badge, no alert, and no sound specified in the
dictionary (for the "aps" key) then a default message will not appear
and it will be completely silent.
Look again at example 5 in the document you referenced. aps can be
empty, and you can specify whatever custom data you would like as they
do with the "acme2" key. The "acme2" data is an example of where your
server's "special" payload could reside within the JSON payload.

parse.com action-loc-key push notifications

I've been trying to find an answer to this all over but I just can't. I know that to change the title of the button on the push notifications on iOS 8 from "View" to something else, I have to specify it in action-loc-key, but how would I do this specifically with Parse.com? Would I create a NSDictionary for alert and make it a key under there and then add that NSDictionary to the JSON payload for the push data or would I add it directly to the push data? Can someone give me an example? T
You can directly set the aps dictionary of the data field of the Parse push payload and set the action-loc-keys exactly as described by Apple.
var payload =
"data":{
"aps":{
"alert":{
"loc-key":"msg",
"loc-args":["John"],
"action-loc-key":"rsp"
},
}
};
// set at least the 'where' key of the payload
Parse.Push.send(payload);

Resources