Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Checking if Notifications Are Enabled

Checking if Notifications Are Enabled

To find out if push notifications are enabled for your app on a particular device, you can use the areNotificationsEnabled method.

var el = new Everlive('your-app-id');
el.push.areNotificationsEnabled(registrationSettings, successCallback, errorCallback);

The successCallback function is called with one boolean argument containing the result of the check—true or false.

The method behaves differently on different platforms:

  • iOS—Checks if push notifications for the app are enabled/disabled in the Notification Center. The registrationSettings parameter is not used; pass null or an empty object instead.
  • Android—Checks if the the device is registered for notifications. The result is independent of the device settings. The registrationSettings parameter is not used; pass null or an empty object instead.
  • Windows Phone—(Not available in NativeScript) Checks if a device has an open channel to receive notifications. The result is independent of the device settings. The registrationSettings parameter must contain the wp8 channelName field as shows in the next example:
var el = new Everlive('your-app-id');
el.push.areNotificationsEnabled(
    { 
        'channelName': 'PushChannelName' // channelName is required for Windows Phone devices
    }, 
    function successCallback(areEnabled) {
        // check whether the notifications are enabled or not
    } , function errorCallback(err) {
        // an error has occurred
    });

Because of vendor specifics and varying user settings this method returning a positive result cannot guarantee that subsequent push notifications will actually be received.

See Also


Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.