Push-notifications: iOS & Android

0 votes

Hi! 

I've 2 questions:

1. I'm trying to send push-notification  from Android to iOS with conditions ( "badge", "sound" .. ) like this:

String message = "Hello";
PushNotificationService pushNotificationService = App42API.buildPushNotificationService();

HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
        otherMetaHeaders.put("dataEncoding", "true");
        otherMetaHeaders.put("alert", message);
        otherMetaHeaders.put("badge", "1");
        otherMetaHeaders.put("sound", "default");
        pushNotificationService.setOtherMetaHeaders(otherMetaHeaders);

        pushNotificationService.sendPushMessageToChannel(channel, otherMetaHeaders, new App42CallBack() { .....

But the message hasn't been sent. What i'm doing wrong?

 

2. How i can receive only message text on push-notification from iOS ? I use Android and in push-notification i can see all conditions from IOS message like this: {"badge:1", "sound:default", ////"} .

My GCMIntentService:

@Override
protected void onMessage(Context context, Intent intent) {
    String message = intent.getExtras().getString("alert"); 
    displayMessage(context, message);
    generateNotification(context, message);
}

 

Tried to put instead "alert" "message" - no result. What i'm doing wrong?
asked Dec 11, 2015 in App42 Cloud API-BaaS by aleksandrov.vasilii (11 points)

1 Answer

0 votes

Hello Developer,

Please find my answer below for your query:

At the time of sending non-english character below code is going to be used:

HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("dataEncoding", "true");

For sending custom parameter at the time of sending push notification like badge, sound etc, please use the code snippet from here. So that at the time of receiving push notification, you can extract exact parameter from push payload. Please use the above code snippet and let us know if you need any help from my side. 

P.S if you are not able to receive push notification then please share your push logs with us. It will help us to provide better support to you. 

Regards,

Himanshu Sharma

answered Dec 12, 2015 by hs00105 (2,005 points)
edited Dec 12, 2015 by hs00105
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
...