cordova-plugin-headsetdetection
Version:
Detect a wired or Bluetooth headset
21 lines (18 loc) • 688 B
JavaScript
var exec = require('cordova/exec');
var HeadsetDetection = {
detect: function (successCallback, errorCallback) {
exec(successCallback, errorCallback, "HeadsetDetection", "detect", []);
},
registerRemoteEvents: function(actionCallback) {
// Need to call a native function to start recieve events on android
exec(null, null, "HeadsetDetection", "registerRemoteEvents", []);
this.actionCallback = actionCallback;
},
remoteHeadsetRemoved: function() {
this.actionCallback && this.actionCallback('headsetRemoved');
},
remoteHeadsetAdded: function() {
this.actionCallback && this.actionCallback('headsetAdded');
}
};
module.exports = HeadsetDetection;