Zxing qr сканирует сбой Blackberry

Я внедряю сканер QR-кода для устройств Blackberry и использую для этого библиотеки ZXing. Кстати, это для ос 6+. У меня проблема в том, что иногда, только иногда, когда камера открывается для подготовки к сканированию, устройство зависает и полностью перезагружается...

В противном случае он работает большую часть времени, я могу сканировать и декодировать коды qr и т. Д. Однако кажется, что иногда он кажется сбоем без причины. Я не знаю, это что-то с камерой или что-то в моем коде, но я предоставлю код.

public void scanBarcode() {

    // First we create a hashtable to hold all of the hints that we can
    // give the API about how we want to scan a barcode to improve speed
    // and accuracy.
    Hashtable hints = new Hashtable();

    // The first thing going in is a list of formats. We could look for
    // more than one at a time, but it's much slower.
    Vector formats = new Vector();
    formats.addElement(BarcodeFormat.QR_CODE);
    hints.put(DecodeHintType.POSSIBLE_FORMATS, formats);

    // We will also use the "TRY_HARDER" flag to make sure we get an
    // accurate scan
    hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);

    // We create a new decoder using those hints
    BarcodeDecoder decoder = new BarcodeDecoder(hints);

    // Finally we can create the actual scanner with a decoder and a
    // listener that will handle the data stored in the barcode. We put
    // that in our view screen to handle the display.
    try {
        _scanner = new BarcodeScanner(decoder, new MyBarcodeDecoderListener());
        _barcodeScreen = new MyBarcodeScannerViewScreen(_scanner);

    } catch (Exception e) {
        return;
    }


    // If we get here, all the barcode scanning infrastructure should be set
    // up, so all we have to do is start the scan and display the viewfinder
    try {
        _scanner.stopScan();
        _scanner.getPlayer().start();
        _scanner.startScan();
        UiApplication.getUiApplication().pushScreen(_barcodeScreen);
    } catch (Exception e) {
    }

}

/***
 * MyBarcodeDecoderListener
 * <p>
 * This BarcodeDecoverListener implementation tries to open any data encoded
 * in a barcode in the browser.
 * 
 * @author PBernhardt
 * 
 **/
private class MyBarcodeDecoderListener implements BarcodeDecoderListener {

    public void barcodeDecoded(final String rawText) {

        //UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
        UtilityDecoder.saveToHistory(rawText);

        try {
            UtilityDecoder.distributeBarcode(rawText);
        } catch (PIMException e) {
        }
    }

}

Обычно я вызываю scanBarcode(), когда нажимаю кнопку на панели инструментов.

Может ли кто-нибудь сказать мне, является ли проблема моим кодом, или устройством, или чем-то еще? Заранее благодарим за любую оказанную помощь!


person Banana Man    schedule 20.02.2012    source источник
comment
Во-первых, обратите внимание, что название демо-версии — BarcodeScan Demo, начиная с версии 6.0; Тогда вы сможете все понять;   -  person alishaik786    schedule 21.02.2012
comment
Я следил за демонстрацией и читал статью.. как я уже сказал, это работает в 95% случаев.. Я просто получаю странные сбои.   -  person Banana Man    schedule 21.02.2012
comment
Где вы получаете сбои? Я запускаю этот образец демо, он не вызывает сбоев, и я создал свою собственную демонстрацию сканирования штрих-кода, взяв предоставленную демонстрацию;;   -  person alishaik786    schedule 22.02.2012
comment
Хорошо, тогда я думаю, что это должно быть мое устройство Blackberry, вызывающее проблему.   -  person Banana Man    schedule 22.02.2012


Ответы (1)