Touch not working on android apps running on ARC - android

I have a laptop running windows 8.1 with a touch enabled screen.
I am using arc to run apk on the laptop.
The touch works fine on ARC welder but after launching apk, the touch event does not work on app's screen. Just the mouse event works.
I have tried multiple apks and everyone behaves same.
Do we have to enable something to make the touch events work?

This is a bug that has been reported here:
https://code.google.com/p/chromium/issues/detail?id=480745

So a way of getting around this at least for map applications is to specifically code the APK to handle the event and you must use the Arc-Metadata tag of
"enableSynthesizeTouchEventsOnWheel": false, this stops the runtime from trying to interpret your scroll wheel as a touch instead of the SOURCE_CLASS it is.
So for the input device SOURCE_CLASS_POINTER, you have to define ACTION_SCROLL so that a mouse scroll wheel will allow you to do actions. There is plenty of examples of how to do this all over StackOverflow though, just disable that meta-tag and most of the code you normally use for making things work in Android will work here.
Note: Haven't tried "enableSynthesizeTouchEventsOnClick": false, and testing with SOURCE_ that equals a external touchscreen but i believe it would work .

Related

CSS touch-action: not always disabling in Cordova app

Question
What am I missing in my CSS to make the results more consistent for no touch actions in my Cordova app?
I am building an app with Cordova (testing on Android). We had a full page selection come up that's not supposed to scroll so I used touch-action: none in the CSS. But it still scrolls but only sometimes.
CSS
body {
touch-action: none;
}
Now I'm showing different "pages" by turning on/off different divs in the html. And what has me super confused is that when it goes to the first page it will scroll.... once! And only once. So I can tap the screen and drag the page up/down, let go and I can't scroll again.
BUT.
I go to the second page and it will do the same thing. It will let me scroll once, but any further touch events get ignored.
The issue with this is my fancy html selector is suffering from this. Where it will work, but periodically allow the page to scroll when it shouldn't.
My understanding is that "touch-action: none" should kill all touch events on Android not just some of them.
After more digging I was able to solve this.
Quick answer. touch-action: none; is perfectly fine.
What wasn't fine was that I was using Chrome's remote developer tools to connect to the device and watch the console. To see what was going on with the app at run time. Because you can touch the application through the developer tools I'm guessing it was managing to screw up touch events. As in ignoring touch-action:none and forcing touch actions to happen. Even if you touched only the real device and not the device "sim" through the developer tools it was still screwing up touch events.
So the solution. You can use the developer tools to make sure you've added the css correctly. Then close the developer tools for the device and run it again in cordova using cordova run android and don't connect using the developer tools.
I spent two working days trying to solve this. :(

Can I enable mouse/desktop-like text selection behavior in an Android app?

I'm using ARC Welder to turn my Android app into a Chrome OS app. Most of it works perfectly, except that text selection with a mouse behaves like it would on a touch device, requiring long-clicking or double-clicking on words, and then dragging the ends. Is there a way around this?
As CommonsWare points out, this is the Android behavior.
Feel free to file a bug even for a feature request.
We are open to allowing the behavior to be changed, but it also seems like something that should be left up to the end user (how do they expect to interact with an Android app on a Chromebook?)

click, tap, touchstart in jquery which when? and how?

So.. I am developing the mobile versions of my website and noticed that my 'rating' script whereby a user selects a certain number of stars did not work on the iPad.
The functionality worked with a jquery .on('click' in a normal web browser.
I googled it and found tap and touchstart
Changing the function to .on('click touchstart' made it work on the iPad. Great !
I have now implemented a form where on checking a checkbox some extra fields are shown/hidden.
Again I used .on('click' - this time I was trying it on an android phone. The .on('click' didnt work for a checkbox..? I tried adding touchstart with no success. I then added tap and bingo it works.
Doing a little more research i noted others saying not to bind two gestures as in certain situations the event could be triggered twice. Fair enough.
COuld someone thus advise and explain how 'clicking' works with different elements on normal web browsers, android devices, and i devices.
An example of how you can then implement only using one gesture, but the right one depending on the device would be great.
N.B Im just using normal jquery.
Many Thanks

Trigger.io and KendoUI Mobile - Layout / view doesn show up until touch

I am trying to work with trigger.io and Kendoui Mobile.
the point is, when launching the mobile app on emulator all works like expected - but when it runs on android mobile the Layout / View doesnt show up until you touch the screen or turn the mobile to landscape or viceversa.
with a tabstrip of kendoui one time showed up you can swtich between views with no problems.
but if you redirect to another view with different layout you have to touch again the screen to show the content (it just shows just the background of body until touch).
the telerik guys at the moment dont know from where it comes from as they tested it with phonegap and no problems.
Maybe the trigger.io guys can find out why it happens?
Best regards
marc
It looks like this is an issue with hardware acceleration on Android 4.0, probably an unfortunate interaction between whatever hardware accelerated transitions Kendo UI use and that particular version of Android.
Phonegap seem to have hardware acceleration disabled by default, which is why they would not be affected.
As a fix we are going to add an option to disable hardware acceleration on that particular Android version, which we'll have live by the end of the week.

Android: How do you emulate a keyboard flip?

While debugging my app using Monkey (which is almost as fun as the real thing), I managed to crash! Yay, that's what it's for, right?
Looking at the log (and while watching) I noticed that Monkey is occasionally doing:
:Sending Flip keyboardOpen=true
which seems to be part of my problem. When this happens, the screen in the emulator rotates 90 degrees, but this is NOT the same as a regular rotation you get by hitting KEYPAD_7. Here's a picture:
It looks to me the emulator is emulating a keyboard opening (flip), which is subtly different from a rotation.
So the question is: How do I emulate that myself? Sure, running Monkey is neat, but waiting for it to randomly choose to send a keyboardOpen message is no way to debug a program.
Maybe use the --pct-majornav to restrict the monkey to just the 'major' nav events (I'm assuming keyboard changes are 'major', I'm not sure though).
You could also look into writing a specific test based on the different but similar monkeyrunner framework: http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html ... but I don't see any way to inject keyboard flip codes.
I found this relevant SO question:
Simulating opening/closing the hardware keyboard in emulator but the "answer" there is confusing and seems insufficient.
Not really your question, but related to your root issue:
Did you forget to include 'keyboardHidden' in the 'android:configChanges' section of the manifest file? (Or did you include it, but you don't handle the config change callbacks?)
The keyboard hide/reveal will restart your activity. You can either declare that you handle that restart, or if you don't, the OS will stop and restart the app itself.
See http://developer.android.com/guide/topics/resources/runtime-changes.html
Update
I believe this is the source for the monkey application's keyboard flip event. It looks like injecting a keyboard flip event would be relatively straight-forward: Open /dev/input/input0 and write 16 magical bytes into it.
Also, the source seems to have an undocumented --pct-flip option for controlling keyboard flip rates: link

Categories

Resources