Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
linenumberstrue
languagejs
var ostype = Titanium.Platform.osname;
var alertString;
function receivePush(e) {
	if(ostype === "android"){
    	alertString = JSON.parse(e.payload).android.alert;
	}
	if(ostype === "iphone" || ostype === "ipad"){
    	alertString = e.data.aps.alert;
	}
}

Sample payload sent push notification in the multiline format on an Android device:

Code Block
linenumberstrue
languagejs
{
   "title": "myApp",
   "alert": "Here, I want to send the multiline push notification messages to the user for the \n details reports.",
   "style": {
      "bigContentTitle": "myApp",
      "bigText": "Here, I want to send the multiline push notification messages to the user for the \n details reports.",
      "summaryText": "Here, I want to send the multiline push notification messages"
   }
}

More examples

For another demonstration of the PushNotification API, run the Cloud demo app and select Push Notifications. The code for the Cloud demo is located in the Cloud module at <PATH_TO_TITANIUM_SDK>/modules/commonjs/ti.cloud/<VERSION>/example/.

...