Hi,
We're experimenting with Urban Airship. We currently use a different notification provider but are are interested in what UA can offer.
Our Cordova app is in the Apple store and Google store so we have some experience in making these things work :)
Our app provides personalised traffic information to London drivers so notifications are a vital part of our app.
We have no problems in generating messages to the UA server from our servers, we also have the UA plugin working in our app.
Our question is around the message format and how we are expected to provide the information to the UA server. We're not looking for technical help, but some guidance on how to structure the data we want to pass to our app. We have also read the documentation :)
A use case may help:
We want to send an IOS silent notification to our app. This is a signal for it to go and collect a lot of updated traffic information from a central server. This is a technique we are already using and it works well for us. We have a lot of data that we don't want to send using a notification.
We create a JSON notification in Perl (we use perl for all backend processes) with
notification => { ios => { 'content-available' => 1 }}
This is correctly passed to the UA server, we then get a push event received at our client
2017-01-02 09:25:33.853 Jambuster[2505:205584] [I] +[UAAppIntegration handleIncomingNotification:foregroundPresentation:completionHandler:] [Line 228] Received notification: {
"_" = "efbb6bca-01b1-4c07-826f-f4a72cc85281";
aps = {
"content-available" = 1;
};
}
This looks good but the event received by our UA JavaScript handler is NOT the same JSON format,
We get
2017-01-02 09:57:45.700 Jambuster[2505:205584] *************************
2017-01-02 09:57:45.700 Jambuster[2505:205584] ***** HandleUrbanAirshipIOSNotification: event = {"message":"","extras":{}}
2017-01-02 09:57:45.700 Jambuster[2505:205584] *************************
returned.
The code for the JavaScript handler is pretty simple, we're just printing it out whilst we check what to do.
function HandleUrbanAirshipIOSNotification(event) {
var debugHandleUrbanAirshipIOSNotification = debugTrue;
if (debugHandleUrbanAirshipIOSNotification)
{
ConsoleLog("*************************");
ConsoleLog("***** HandleUrbanAirshipIOSNotification: event = " + JSON.stringify(event));
ConsoleLog("*************************");
}}
We have experimented with passing extra information in the extras field, e.g. a second content-available flag and that seems to work, but it doesn't feel right. We *think* we should get the same JSON format in our handler and NOT have to pass additional information in the extras field.
{
"_" = "efbb6bca-01b1-4c07-826f-f4a72cc85281";
aps = {
"content-available" = 1;
};
}
Looking through the docs doesn't seem to shed any light on this, e.g. how would we handle the content-available flag without passing it in the config twice.
Any suggestions welcomed.
Thanks
Rob
Comments
3 comments