Issue with Zbar qr code scanner on Sony Phone

2019-06-07 13:53发布

I am developing an android application that scans QR codes using the Zbar API. However upon testing, I have noticed that the application worked perfectly fine on Samsung, HTC and a chinese brand phone but not on a sony device(Xperia z1). What happens is that the camera and viewer works fine in the first few seconds but suddenly crashes. Is there an issue with regards to the Zbar API for it not to work with Sony phones, or is this an isolated scenario?? Are there already solutions for this kind of problem?? I do not know if this is the correct place to post it. I cannot try getting the error from logcat since the device is used by a customer, and I do not have a sony device available for me to test it.

1条回答
一夜七次
2楼-- · 2019-06-07 14:46

Try these settings on the ImageScanner,

scanner = new ImageScanner();
//Slows the frame, but does the job
scanner.setConfig(0, Config.X_DENSITY, 1);
scanner.setConfig(0, Config.Y_DENSITY, 1);
scanner.setConfig(0, Config.ENABLE, 0);
// Only enable the codes your app requires
scanner.setConfig(Symbol.QRCODE, Config.ENABLE, 1);

Made a huge difference in my app.

查看更多
登录 后发表回答