A node.js lib to access the Apple Notification Center Service (ANCS)
npm install ancs
A node.js lib to access the Apple Notification Center Service (ANCS)
``sh`
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
`javascript`
var ANCS = require('ancs');
`javascript`
ANCS.discover(callback(ancs));
`javascript`
ancs.connect(callback);
`javascript`
ancs.disconnect(callback);
`javascript`
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
#### Read App Identifier
`javascript`
notification.readAppIdentifier(function(appIdentifier) {
// ...
});
#### Read Title
`javascript`
notification.readTitle(function(title) {
// ...
});
#### Read Subtitle
`javascript`
notification.readSubtitle(function(subtitle) {
// ...
});
#### Read Message
`javascript`
notification.readMessage(function(message) {
// ...
});
#### Read Date
`javascript`
notification.readDate(function(date) {
// ...
});
#### Read All Attributes
`javascript``
notification.readAttributes(function(attributes) {
// ...
});
* attributes has the following properties
* appIdentifier
* title
* subtitle
* message
* date
