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
- other
- news
- healthAndFitness
- businessAndFinance
- location
- entertianment
- categoryCount
- uid
- event (one of):
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