ancs

A node.js lib to access the Apple Notification Center Service (ANCS)

npm install ancs
9 downloads in the last week
24 downloads in the last month

ancs

A node.js lib to access the Apple Notification Center Service (ANCS)

Install

npm install ancs

Prerequisites

  • iOS 7 device with an app in peripheral mode which exposes ANCS
  • your iOS device will ask to be paired with your Mac

Usage

var ANCS = require('ancs');

Discover

ANCS.discover(callback(ancs));

Connect

ancs.connect(callback);

Disconnect

ancs.disconnect(callback);

Notification Events

ancs.on('notification', function(notification) {
    ...
});
  • notification has the following properties
    • event (one of):
      • added
      • modified
      • removed
    • flags (array):
      • silent
      • important
    • category (one of):
      • other
      • incomingCall
      • missedCall
      • voicemail
      • schedule
      • email
      • other
      • news
      • healthAndFitness
      • businessAndFinance
      • location
      • entertianment
    • categoryCount
    • uid

Operations for 'added' or 'modified' notifications (event property)

Read App Identifier

notification.readAppIdentifier(function(appIdentifier) {
  ...
});

Read Title

notification.readTitle(function(title) {
  ...
});

Read Subtitle

notification.readSubtitle(function(subtitle) {
  ...
});

Read Message

notification.readMessage(function(message) {
  ...
});

Read Date

notification.readDate(function(date) {
  ...
});

Read All Attributes

notification.readAttributes(function(attributes) {
  ...
});
  • attributes has the following properties
    • appIdentifier
    • title
    • subtitle
    • message
    • date
npm loves you