1 of 1 people found this helpful
Please see below, the answers for your questions:
1. Using system API, you can check whether it is running on Rhosimulator or not as shown below,
Use "if !Rho::System.isRhoSimulator" instead of "if defined?(Rho::Barcode)".
2. You should enable the scanner in the click action for android device and in the view action, check using system api whether it is running on WM devices or not.
3. You can disable scanner in the barcode callback event.
Thanks for the answer, points 1 and 2 provide interesting info, but about the disable in the callback event:
in that view, the use of the barcode scanner is optional. I want the user to be able to scan if he wants to, or just tap manually the correct item on the list. So, there is a chance he leaves the view without having executed the callback event.
How I solve this, is simply disabling the scanner on the next view, and I think that is resposible for the crashes when I tap in and out of the view rapidly. Is there any other way to disable the scanner? Am I doing this wrong?
What I have done on some projects is check whether running on a Motorola device or not. This should work to detect either a Windows or Android based Motorola device. If not a Motorola device, show a scan button.
<% if !Rho::System.isMotorolaDevice %>
// submit some dummy scan data
Note that I am using 2 different callback functions, as the data comes back in a slightly different form depending on whether it is from a scanner or the camera. The barcode comes back in the "barcode" parameter if camera, and in "data" if from the scanner.