Issue with Zbar qr code scanner on Sony Phone

和自甴很熟 提交于 2019-12-08 05:53:45

问题


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:


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.



来源:https://stackoverflow.com/questions/27816726/issue-with-zbar-qr-code-scanner-on-sony-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!