Im trying to made an application where use a bluetooth keyboard(barcode scanner) and it with the PewPew demo sample working perfectly until put a newWebView into the scene. After that the key event not fired. Anybody tried to get back that event?
I have an app with a native.newWebView in it and I enabled the key events. With the webView showing I see the keys I press showing up in the console log.
I’m doing this in the simulator.
What version of Corona SDK are you using?
What OS are you testing on?
Are you testing in the simulator or on device?
What device are you testing on?
Im tried with the latest daily, with Samsungs S2, MinimalOS , Android 5.1.1 and a Symbol LI4278 bluetooth barcode reader.
Im uploaded the code into the github: https://github.com/robi772/CoronaBluetoothBarcode
Maybe something important is missing from the code.
If the native UI (TextFields, WebViews, etc.) has the *focus*, then it’ll likely steal the key events.
This is the normal native behavior of the OS. Also note that this makes sense. WebViews do support keyboard input such as the arrow keys to scroll the page, tab key to switch to the next web field/link, etc.
So, what you need to do is remove the focus from the WebView and re-assign it to your app window as shown below. Note that you need to do this *after* you display your WebView.
native.setKeyboardFocus(nil)
The only issue is that if you tap on the WebView, then the focus will switch back to the WebView and it’ll start stealing key events again.
This is working, just only need a timer which periodically get back the focus from the webview if somebody clicked.
I have an app with a native.newWebView in it and I enabled the key events. With the webView showing I see the keys I press showing up in the console log.
I’m doing this in the simulator.
What version of Corona SDK are you using?
What OS are you testing on?
Are you testing in the simulator or on device?
What device are you testing on?
Im tried with the latest daily, with Samsungs S2, MinimalOS , Android 5.1.1 and a Symbol LI4278 bluetooth barcode reader.
Im uploaded the code into the github: https://github.com/robi772/CoronaBluetoothBarcode
Maybe something important is missing from the code.
If the native UI (TextFields, WebViews, etc.) has the *focus*, then it’ll likely steal the key events.
This is the normal native behavior of the OS. Also note that this makes sense. WebViews do support keyboard input such as the arrow keys to scroll the page, tab key to switch to the next web field/link, etc.
So, what you need to do is remove the focus from the WebView and re-assign it to your app window as shown below. Note that you need to do this *after* you display your WebView.
native.setKeyboardFocus(nil)
The only issue is that if you tap on the WebView, then the focus will switch back to the WebView and it’ll start stealing key events again.
This is working, just only need a timer which periodically get back the focus from the webview if somebody clicked.