Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Empty payload when sending push notifications from a third party server.

$
0
0

I need to send push notification to my application using my own server. I have done all the needed setup for the ASC application for the development environment, and then started by retrieving the user device token from google servers using ti.cloudpush module .

if (OS_ANDROID){
    cloudPush = require("ti.cloudpush");
    // Initializing the ti.cloudpush module
    cloudPush.retrieveDeviceToken({
        success: deviceTokenSuccess,
        error: deviceTokenError
    });
    cloudPush.setEnabled(true);
    // Process incoming push notifications
    cloudPush.addEventListener("callback", receivePush);
}
i do get the user device token , but instead of subscribing the user to push notifications using Titanium.Cloud.Pushnotifications API, i store the user device token on a database on my own server , so i can send push notifications from my own server using a simple php script.

The problem is that when i send push notifications using my own script, the device do receive the push notification but the payload parameter is empty , see bellow the received push notification.

{
    "type": "callback",
    "source": {
        "pushType": "gcm",
        "invocationAPIs": [],
        "bubbleParent": true,
        "showTrayNotification": true,
        "enabled": false,
        "__propertiesDefined__": true,
        "singleCallback": false,
        "_events": {
            "callback": {}
        },
        "focusAppOnPush": false,
        "debug": false,
        "showAppOnTrayClick": true,
        "showTrayNotificationsWhenFocused": false,
        "apiName": "Ti.Module"
    },
    "payload": "",
    "bubbles": false,
    "cancelBubble": false
}
as you can see the payload parameter is empty , and i also noticed the presence of apiName: Ti.Module which doesn't seems logic to me, since i don't send the push notifications via the Titanium Cloud Consol .

i don't know if there is a specific structure for the payload when it comes to a titanium application , i have followed google's guid lines for payload structure , bit i still don't understand why i'm getting an empty payload. you can see bellow my payload structure.

{
    "registration_ids":["RecivedDeviceTokenFormTiCloudModule"],
    "data":{
        "alert":"This is a message from my own server"
        }
}

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>