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.