Push notifications in iOS in JSON format

0 votes

Hi,

is there any way to send a notification like this (multilanguaje) from CloudApi??

{
    "aps" : {
        "alert" : {
            "loc-key" : "GAME_PLAY_REQUEST_FORMAT",
            "loc-args" : [ "Jenna", "Frank"]
        },
        "sound" : "chime.aiff"
    },
    "acme" : "foo"
}

Notification is sent successfully but never appears to show in iOS8.

asked May 4, 2015 in App42 Cloud API-BaaS by davidrelgr (60 points)

1 Answer

0 votes
 
Best answer

Hello David,

As of now localization is not supported, I have recorded your request in our product pipeline which you can find from here. This feature will be available in this month end release. We update this thread as well once it will be available for use.

Let me know if you need any other help regarding this.

Thanks.

answered May 5, 2015 by rajeev.etc (1,660 points)
selected May 5, 2015 by davidrelgr
Thank you so much. I'll wait for these changes.
As I said to your partner, I need to send this JSON from JAVA API:

{

    "aps" : {

        "alert" : {

            "loc-key" : "GAME_PLAY_REQUEST_FORMAT",

            "loc-args" : [ "Jenna", "Frank"]

        },

        "sound" : "chime.aiff"

    },

    "any-customkey" : "any-value"

}

(pay atention in "any-customkey" outside the "aps" object)

Thanks :)
Hi David,
The localization of push is now available in App42 Cloud. You can start implementing it now.
Here is code snippet for the same:
NSDictionary *alertDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Hello, how are you?",@"body",  
@"GAME_PLAY_REQUEST_FORMAT",@"loc-key"@"My Luck",@"title", @"LOC_TITLE",@"title-loc-key",@"VIEW_BUTTON",@"action-loc-key",
 [NSArray arrayWithObjects:@"Hello", nil],@"loc-args", nil];
        
        NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
        [dictionary setObject:alertDict forKey:@"alert"];
        [dictionary setObject:@"default" forKey:@"sound"];
        [dictionary setObject:@"increment" forKey:@"badge"];
       
        PushNotificationService *pushObj=[App42API buildPushService];
        
        [pushObj sendPushMessageToUser:@"userName"  withMessageDictionary:dictionary completionBlock:^(BOOL success, id responseObj, App42Exception *exception) {
            if (success) {
                PushNotification *push = (PushNotification*)responseObj;
                responseView.text = push.strResponse;
            }
            else
            {
                NSLog(@"Reason = %@",exception.reason);
                responseView.text = exception.reason;
            }
            
            [indicator stopAnimating];
            indicator.hidden = YES;
            
        }];

Please let us know if you face any problem.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...