BarcodeScanner icon indicating copy to clipboard operation
BarcodeScanner copied to clipboard

No scanning on Windows Phone

Open quape opened this issue 11 years ago • 13 comments

Great scanner! Works perfectly on Android for me. On Windows Phone (8.1), the camera is startet but nothing happens afterwards. Cannot even hit the back button to cancel. I building with build.phonegap. What shall I do?

quape avatar Oct 07 '14 06:10 quape

Ok it's probably because I'm using the "official" version from the PGB repository which is old and buggy. Maybe you could submit the latest version from here to PGB so that the scanner will also work on Windows Phone.

quape avatar Oct 08 '14 08:10 quape

I'm having the exact same problem ... I downloaded the version from https://github.com/wildabeast/BarcodeScanner . Isn't this the latest one?

Pieterheule avatar Oct 23 '14 14:10 Pieterheule

Yes. The docs say it should work on WP8 but it doesn't. Did you compile it using the WP8 SDK for Windows or did you use the PhoneGap build service? The version on PGB is not the current one from GridHub so I don't know if that version should support WP8 or not but I doubt it. It's really a mess with support and documentation.

quape avatar Oct 24 '14 21:10 quape

I am having the exact same problem.

I installed the plugin from github using: cordova plugin add https://github.com/wildabeast/BarcodeScanner.git

And compiled using: cordova build wp8

I have the windows phone 8.1 sdk installed and am testing on an 8.1 device.

I am not using phonegap build, I am sending the app to the device from Visual Studio via the generated .sln file in the wp8 platform folder.

Has anyone had any luck with this issue/know what is going on?

emiller12 avatar Oct 29 '14 04:10 emiller12

Try this branch: https://github.com/bloxlab/BarcodeScannerWP8 It seems to have some fixes. Unfortunately I'm not able to test it because I'm on a Mac and Visual Studio in a VM consumes too much RAM. It really makes me cry that this plugin isn't maintained properly anymore.

quape avatar Oct 29 '14 19:10 quape

Thanks.

I am now seeing a slightly different outcome, both when using the branch you suggested AND when using Wildabeast's original.

The camera opens up and allows me to scan barcodes fine (I even get the success vibration), however the success/fail call back functions are never fired, and I get the following error:

Failed to locate callback for id : BarcodeScanner49332169

Without the callbacks firing I am unable to do anything with the data captured from the barcode.

Do you have any idea what could be causing this issue?

emiller12 avatar Oct 30 '14 00:10 emiller12

Good to know that's one step better now. I just did some search but haven't found out what this error could mean. You could try to reach the author of the other branch. Please tell me when you got it running.

quape avatar Oct 30 '14 05:10 quape

Hi,

Yes I posted an issue to the other branch and got a reply straight away: https://github.com/bloxlab/BarcodeScannerWP8/issues/4

The workaround/hack he suggested fixed the problem.

Now I just have the problem of having to switch between the two plugins when I want to build for different platforms...

So I tried Dawson Loudon's branch: http://stackoverflow.com/questions/24313144/possible-to-install-multiple-phonegap-plugins-for-same-function https://github.com/dawsonloudon/BarcodeScanner

But I am getting a different error again (still only on the Windows Phone, Android works fine) as per this issue here: https://github.com/dawsonloudon/BarcodeScanner/issues/1

Will see if I get a response.

Thanks for your help.

Regards, Elliott

emiller12 avatar Oct 30 '14 05:10 emiller12

Nice, so at least it works on WP8 now! I thought the boxlab branch just fixes the WP8 probs but also works for Android and iOS?

Switching plugins would be OK for me for now.

quape avatar Oct 30 '14 05:10 quape

My understanding is that the boxlab plugin is Windows Phone only. I got "class not found" when I tried scanning a barcode with the boxlab scanner on an Android phone.

emiller12 avatar Oct 30 '14 06:10 emiller12

This should really be merged together. I like PhoneGap. The big advantage of PhoneGap is that it supports all three platforms and it should deal with WP8 without compromises. But if I wouldn't want to develop for WP8 I shouldn't use PhoneGap at all because of it's poor documentation and support. And crappy things like this here.

quape avatar Oct 30 '14 07:10 quape

Found fix(hack) for this issue: platforms\wp8\cordovalib\Commands\BaseCommand.cs DetatchHandlers()replace with:

public void DetachHandlers()
 {
        this.OnCommandResult = null;
        this.OnCustomScript = null;
        foreach (string callbackId in new List<string>(ResultHandlers.Keys))
        {
            if (!callbackId.ToLower().Contains("barcodescanner"))
            {
                RemoveResultHandler(callbackId);
            }
        }
}

original post here: http://stackoverflow.com/questions/26130837/cordova-wp8-datepickerplugin-callback-not-found

akozlov75 avatar Dec 03 '14 10:12 akozlov75

Thanks, it worked.

klante avatar Sep 20 '15 12:09 klante