Provides methods for accessing Arrow push notification channels.
For information on configuring and setting up push notifications, see the Push Notifications guide.
The methods in this module are used to subscribe and unsubscribe from Arrow push notification channels, and to generate Arrow push notifications. Push notifications are received using platform-specific mechanisms:
callback
callback. See
Network.registerForPushNotifications
for details.To register for push notifications, you need to obtain an application-specific device token. To obtain a device token:
success
callback.success
callback.This example subscribes to a push notification channel and checks the response.
Cloud.PushNotifications.subscribe({
channel: 'friend_request',
device_token: myPushDeviceToken
}, function (e) {
if (e.success) {
alert('Success');
} else {
alert('Error:\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});
This example unsubscribes from a push notification channel and checks the response.
Cloud.PushNotifications.unsubscribe({
channel: 'friend_request',
device_token: myPushDeviceToken
}, function (e) {
if (e.success) {
alert('Success');
} else {
alert('Error:\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});
This example sends a push notification to a channel and checks the response.
Cloud.PushNotifications.notify({
channel: 'friend_request',
payload: 'Welcome to push notifications'
}, function (e) {
if (e.success) {
alert('Success');
} else {
alert('Error:\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});
This example updates the user's notification subscription with the device's current location, upon successfully obtaining the device's current position.
var latitude, longitude,
var pushDeviceToken; // Device token obtained earlier...
Titanium.Geolocation.getCurrentPosition(function(e) {
if (e.error) {
Ti.API.error('Error: ' + e.error);
} else {
latitude = e.coords.latitude;
longitude = e.coords.longitude;
Cloud.PushNotifications.updateSubscription({
device_token: pushDeviceToken,
loc: [longitude, latitude]
}, function (e) {
if (e.success) {
alert('Subscription Updated.');
}
else {
alert(e);
}
});
}
});
The name of the API that this proxy corresponds to.
The name of the API that this proxy corresponds to.
The value of this property is the fully qualified name of the API. For example, Button
returns Ti.UI.Button
.
Indicates if the proxy will bubble an event to its parent.
Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.
Default: true
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.
Applies the properties to the proxy.
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.
A dictionary of properties to apply.
Send a push notification to a channel.
Requires user login.
See push_notifications/notify.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Send a push notification to a channel to the specified devices.
See push_notifications/notify_tokens.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Custom query of push notification subscriptions with paginating.
See push_notifications/query.json for the request parameters supported by this method.
Data is returned in the subscriptions
property of the parameter passed to the callback.
Parameters to send in the request.
Callback function to execute when the method completes.
Returns a list of push notification channels the user is subscribed to.
Requires user login.
See push_notifications/channels/query.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Resets the badge value to zero but does not update it on the device.
To update the badge in the device's UI, send a push notification to the device with the
badge
field defined.
The REST API call supports calling this method as either a PUT request or a GET request. This method only supports the PUT request, which means a device token must be passed to this method.
See push_notifications/reset_badge.json for the request parameter supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Sets the badge value but does not update it on the device.
To update the badge in the device's UI, send a push notification to the device with the
badge
field defined.
See push_notifications/set_badge.json for the request parameter supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Sets the value of the bubbleParent property.
New value for the property.
Sets the value of the lifecycleContainer property.
New value for the property.
Returns the number of devices subscribed to the specified channel.
Requires user login.
See push_notifications/channels/show.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Subscribe a mobile device to a push notification channel.
Requires user login.
See push_notifications/subscribe.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Subscribe a mobile device to a push notification channel using a device token.
See push_notifications/subsribe_tokens.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Unsubscribe a mobile device from a push notification channel.
Requires user login.
See push_notifications/unsubscribe.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Unsubscribe a mobile device from a push notification channel using a device token.
See push_notifications/unsubscribe_tokens.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.
Updates a user's notification subscription with the device's location.
This allows an Appcelerator Dashboard administrator to send push notifications to devices located within a specified geographic region. For details, see Sending and scheduling push notifications.
See push_notifications/unsubscribe.json for the request parameters supported by this method.
Parameters to send in the request.
Callback function to execute when the method completes.