Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Made minor changes

...

How your application subscribes its users (session- or token-base subscriptions) affectdetermine, to a degree, your options for delivering notifications. In short, if you need to send notifications to specific API Builder users, use session-based subscriptions. For instance, a mobile banking app would want to notify individual account holders. If you don't need to target specific users, token-based subscriptions are a good approach, as it doesn't require the additional step of setting up an API Builder account. 

...

To send a notification to users located in a geographic area, the application must have first provided their current location to API Builder. For details, see Updating Subscriptions with Device Location

Appcelerator Dashboard provides two views for sending notifications, Standard and Advanced. The Standard view provides an easy way to send notifications without having to understand the payload structure. In the Advanced view, you manually create the JSON payload. The advanced form provides additional flexibility, such as including custom payload fields. 

...

The payload can also include custom fields that your application can read and use as desired. See Custom JSON Payloads for an example of using custom fields.

Custom JSON payloads

Appcelerator Dashboard provides two forms, Standard and Advanced, for you to compose the payload. In the Standard form, you use common form controls to compose the payload, without having to write JSON code. In the Advanced form, you manually enter the JSON-encoded string that's sent in the notification. The JSON object can contain any of the standard fields discussed in About Notification Payloads, or custom fields specific to your application. For example, the following payload contains alert and sound fields, as well as a custom field named high_score.

...

Below is a more advanced custom JSON payload:

Code Block
{
    "alert": "Sample alert",
    "badge": "+2",
    "category": "sampleCategory", 
    "icon": "little_star",
    "sound": "door_bell",
    "title": "Example",
    "vibrate": true,
    "custom_field_1": "Arrow Push Rocks!",
    "custom_field_2": "Hi Push"
}

When the device receives this payload, it will do the following:

  • Display the "Sample alert" message.
  • Increment the current badge value by two.
  • Play the "door_bell" audio file.
  • On Android devices: 
    • The notification title will be set to "Example"
    • The device will vibrate
    • The "little_star" icon will be displayed in the notification area.
  • On iOS 8 devices and later:
    • The user notification actions associated with the "sampleCategory" user notification category.

About JSON Payloads Delivered to Devices 

The notification payload that Mobile Backend Services delivers to either FCM or GCM or APNS is slightly modified from the original JSON payload you provide to Dashboard. Also, the payloads are slightly different for Android and iOS devices.

For Android, all Android-specific fields are contained in an android dictionary, while all other iOS-only and custom fields are top-level keys of the payload. For example, the payload shown in Custom JSON payloads will be delivered to an Android application as follows:

Code Block
{
    "android": {
        "title": "Example",
        "alert": "Sample alert",
        "icon": "little_star",
        "badge": "+2",
        "sound": "door_bell",
        "vibrate": true,
    },
    "category": "sampleCategory",
    "custom_field_1": "Arrow Push Services Rocks!",
    "custom_field_2": "Hi Push"
}

For iOS devices, all iOS-specific fields are contained in an aps dictionary, while all Android-specific and custom fields are top-level keys of the payload. For example, For example, the payload shown in Custom JSON payloads will be delivered to an iOS application as follows:

Code Block
{ "aps": { "alert": "Sample alert", "badge": "+2", "category": "sampleCategory", "sound": "door_bell", }, "title": "Example", "icon": "little_star", "vibrate": true, "custom_field_1": "Arrow Push Rocks!", "custom_field_2": "Hi Push" }

 

Notification Features

Interactive Notifications (iOS 8 and later)

...

  1. In your Titanium application:
    1. Create and configure notification actions.
    2. Create notification categories and assign notification actions to them.
    3. Register the application for the desired notification categories, and to receive push notifications.

    4. Register an event listener for the remotenotificationaction event, to respond to user actions when they interact with the notification.
  2. In Dashboard, send a new push notification and set the Category field to the desired notification category to use.

...

In general, this error indicates that the recipients you selected are not subscribed to the specified channel. If you're sending a notification to specific API Builder users, make sure that those users are subscribed to the specified channel. Or, if you're sending a token-based notification (not addressed to specific users) make sure that channel name you specified has at least one subscriber. See Viewing subscribed devices for more information.

...