ancs

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

ancs

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

npm install ancs
  • iOS 7 device with an app in peripheral mode which exposes ANCS
  • your iOS device will ask to be paired with your Mac
var ANCS = require('ancs');
ANCS.discover(callback(ancs));
ancs.connect(callback);
ancs.disconnect(callback);
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
notification.readAppIdentifier(function(appIdentifier) {
  // ... 
});
notification.readTitle(function(title) {
  // ... 
});
notification.readSubtitle(function(subtitle) {
  // ... 
});
notification.readMessage(function(message) {
  // ... 
});
notification.readDate(function(date) {
  // ... 
});
notification.readAttributes(function(attributes) {
  // ... 
});
  • attributes has the following properties
    • appIdentifier
    • title
    • subtitle
    • message
    • date