EddyVerbruggen / HeadsetDetection-PhoneGap-Plugin

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

Unable to make it work #3

Closed slacktracer closed 8 years ago

slacktracer commented 8 years ago

Hey, I installed it with the lines:

$ cordova plugin add https://github.com/EddyVerbruggen/HeadsetDetection-PhoneGap-Plugin.git $ cordova prepare

But it did not work.

I used the example:

    try {
        window.plugins.headsetdetection.detect(function(detected) {
            // alert(detected)
            document.getElementById('catch').innerHTML = 'OK ' + detected;
        })
    } catch (e) {
        document.getElementById('catch').innerHTML = 'ERROR' + e;
    }

I was receiving a CANNOT READ PROPERTY 'DETECT' OF UNDEFINED.

I added the HeadsetDetection.js to do a test and I don't get the error but the callback is never called.

I am using Phonegap desktop for windows and the android app.

What am I missing? I did not find any answer to this, but I am not sure what to look for either...

EddyVerbruggen commented 8 years ago

Try waiting for deviceready to fire before using a plugin. And most plugins only work in a standalone app on your device.

ziomangler commented 8 years ago

Hi Eddy! How are you??

What does it means?

I finished the development of my app and we are ready to go online in the store next days.

Is there some problem with the plugin?? It would be the worst news ever :(

Alex

Da: Eddy Verbruggen [mailto:notifications@github.com] Inviato: domenica 21 febbraio 2016 19:28 A: EddyVerbruggen/HeadsetDetection-PhoneGap-Plugin HeadsetDetection-PhoneGap-Plugin@noreply.github.com Oggetto: Re: [HeadsetDetection-PhoneGap-Plugin] Unable to make it work (#3)

Try waiting for deviceready to fire before using a plugin. And most plugins only work in a standalone app on your device.

— Reply to this email directly or view it on GitHub https://github.com/EddyVerbruggen/HeadsetDetection-PhoneGap-Plugin/issues/3#issuecomment-186880978 . https://github.com/notifications/beacon/AGdR8VnKPoiwvx2Ncmyhjovtu2vuODRGks5pmfk-gaJpZM4HfB7B.gif

slacktracer commented 8 years ago

@EddyVerbruggen

I see. Thank you so much! I was lost.

I will close it...

slacktracer commented 8 years ago

By the way, @ziomangler

It worked like a charm. Just fine.

Thank very much again, @EddyVerbruggen

ziomangler commented 8 years ago

Yes thank you ^^

Da: slacktracer [mailto:notifications@github.com] Inviato: lunedì 22 febbraio 2016 17:28 A: EddyVerbruggen/HeadsetDetection-PhoneGap-Plugin HeadsetDetection-PhoneGap-Plugin@noreply.github.com Cc: ziomangler ziomangler@tiscali.it Oggetto: Re: [HeadsetDetection-PhoneGap-Plugin] Unable to make it work (#3)

By the way, @ziomangler https://github.com/ziomangler

It worked like a charm. Just fine.

Thank very much again, @EddyVerbruggen https://github.com/EddyVerbruggen

— Reply to this email directly or view it on GitHub https://github.com/EddyVerbruggen/HeadsetDetection-PhoneGap-Plugin/issues/3#issuecomment-187253905 . https://github.com/notifications/beacon/AGdR8cTowk0SuFN7FAuG9kaau0D89k2Rks5pmy6TgaJpZM4HfB7B.gif