Giter Site home page Giter Site logo

headsetdetection-phonegap-plugin's Issues

Why this plugin doesn't work when cordova-plugin-media is recording

Hi Eddy, I'm a big fan of your cordova plugins thanks a lot.
I am facing an issue on this one, I can make it work super nicely but when cordova-plugin-media is actually recording your headset detection event doesn't trigger.
I don't see why so far and I cannot find in your code any potential reason.
Would you mind checking ?
Thanks

HeadsetDetection.m:9:33: error: no visible @interface for 'CDVPluginResult' declares the selector 'toSuccessCallbackString

Hi @EddyVerbruggen ,
when building the plugin with an ionic app for ios, I'm getting an error with cordova-ios-4 but it's working with [email protected] with a deprecation warning (see details below).
Sorry not being able to help you as I do not have any knowledge about objectiveC ...
Thank you very much for the fix,
Mirko

[email protected] :
/Users/mirko/myApp080316/platforms/ios/CPM App/Plugins/nl.x-services.plugins.headsetdetection/HeadsetDetection.m:9:9: warning: 'writeJavascript:' is deprecated: Deprecated in Cordova 3.6. Use the CDVCommandDelegate equivalent of evalJs:. This will be removed in 4.0.0 [-Wdeprecated-declarations]

[self writeJavascript:[result toSuccessCallbackString:callbackId]];

^

[email protected] , [email protected] , [email protected] :
/Users/mirko/myApp080316/platforms/ios/CPM App/Plugins/nl.x-services.plugins.headsetdetection/HeadsetDetection.m:9:33: error: no visible @interface for 'CDVPluginResult' declares the selector 'toSuccessCallbackString:'

[self writeJavascript:[result toSuccessCallbackString:callbackId]];

                 ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~

1 error generated.

** BUILD FAILED **

Unable to make it work

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...

registerRemoteEvents only fires when I register it

Unfortunately the registerRemoteEvents only fires when I register it, and it always returns "headsetRemoved" (even if the BT headset is already connected). When I connect/disconnect a BT headset, the event won't fire. The HeadsetDetection.detect function works well though.

(Android 10, Huawei P30 Pro)

plugin not working on android 5.1.1

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

NativeScript port

Hi Eddy,
I was wondering how hard is it to port this cordova plugin to a nativescript module ?
Do I have to know the Android and IOS developer API reference ?
Thanks,

How can I remove the registerRemoteEvents listener?

If the customer enables this option, then only I have to detect it automatically otherwise, I want to remove this listener, but currently, if I once add this registerRemoteEvents event I can not able to remove it.

Ionic2

I would like to know if it works on Ionic2.

Question: Headset Type

Hi there,

thanks for that great Plugin.
I just wondered - would it be possible to distinguish between a "cabled" and a "wireless" Headset somehow?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.