EddyVerbruggen / HeadsetDetection-PhoneGap-Plugin

:headphones: A PhoneGap plugin for detection of a headset (wired or bluetooth)
34 stars 27 forks source link

plugin not working on android 5.1.1 #10

Open nipungarg6138 opened 6 years ago

nipungarg6138 commented 6 years ago

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? }