I use the phone-gap plugin for the same
HTML:
<button class="button button-stable" ng-click="checkHeadphone()">
JS:
$scope.checkHeadphone = function () {
window.plugins.headsetdetection.detect(function (detected) {
alert("Headphone " + detected)
})
}
user9106967
source
share