I tried the plugin and Android 5 it was working fine. But on Android 5.1.1 it is not working. I mean not detecting headset.
Below are the codes.
function plays() {
window.HeadsetDetection.detect(function(detected) {
alert('hi');
window.plugins.insomnia.keepAwake()
cordova.plugins.tonegenerator.play(250)
})
document.addEventListener('deviceready', function() {
window.HeadsetDetection.registerRemoteEvents(function(status) {
switch (status) {
case 'headsetAdded':
// alert('hi');
window.plugins.insomnia.keepAwake()
cordova.plugins.tonegenerator.play(250)
break;
case 'headsetRemoved':
alert('Please connect to Headset/Earpiece then play.');
break;
};
});
}, false);
Any advise what am i doing wrong?
}
I tried the plugin and Android 5 it was working fine. But on Android 5.1.1 it is not working. I mean not detecting headset. Below are the codes.
function plays() { window.HeadsetDetection.detect(function(detected) { alert('hi');
window.plugins.insomnia.keepAwake() cordova.plugins.tonegenerator.play(250) })
document.addEventListener('deviceready', function() { window.HeadsetDetection.registerRemoteEvents(function(status) { switch (status) { case 'headsetAdded': // alert('hi'); window.plugins.insomnia.keepAwake() cordova.plugins.tonegenerator.play(250) break; case 'headsetRemoved': alert('Please connect to Headset/Earpiece then play.'); break; }; }); }, false); Any advise what am i doing wrong? }