Our's is a mobile application developed using ADF mobile browser and myapache trinidad components.
We have a requirement of counting characters entered by the user in a . For it, we call a javascript on the onkeypress event of . The page works fine on iphone but in samsung galaxy, the event seems not to be fired. However, on the press of back and cancel button, the event fires well and displays the counter value. But it doesn't work with any other key. seems there is some issue with the keypad design of the phone. Is there any work around?
Related
I have an Ionic (5) app and I want to detect a long press on a key (keyboard) when the app is running on a mobile device (I'm testing on Android).
I added (keyup) and (keydown) to a ion-input, and when I run the app on browser I'm able to get the time difference between the first keydown event (if I long press on a key, keydown is firing multiple times) and the single keyup event that i receive when the key is released.
Unfortunately, this solutions isn't working on mobile (Android), I only receive one keydown event and one keyup event that fire almost at the same time, even if I press the enter key for more than 5 seconds or so.
I don't think any code is needed, since this one is more a conceptual question.
How can detect a long press on a mobile keyboard?
In android this isn't going to work. It's just not how the keyboard interface happens. By and large, keyboards don't actually send key events in Android. They send commitText messages, which just send a string to the text field. Anything turning it into key up and key down events is in the Ionic framework. Since the keyboard doesn't send key events, the app can't know how long they pressed the button. They keyboard doesn't send that info. So the Ionic framework that's making the key events can't give you that info either, there's no data for it to extrapolate from.
You're going to have to come up with a different UX design, this will never work on Android.
I am working on an android app to run as a front end on my Parrot Asteroid Smart which runs a modified version of gingerbread as my cars headunit.
At present the unit natively senses the reverse gear signal and displays a "complete action using" dialog which displays one of two camera applications.
I don't have a camera but what I want to do when it senses reverse is to reduce the volume to a set value. I have completed the code to do volume adjustment, however.
I am having an issue determining what button input or trigger the reverse gear is producing. I have already tried some code which logs the onKeyDown event which I have confirmed works when I click the menu or back button but when I trigger the reverse signal there is no log for a keydown.
Although I have a number of years experience in other languages I am new to android app development and java so no suggestion is to ridiculous at this time.
It seems to me like the reverse gear is triggering an Intent since it displays the app chooser dialog. It is probably sending a MediaStore.ACTION_IMAGE_CAPTURE intent or something similar that will require a camera app to complete. If that is the case, then you could modify your app and register to receive those intents and handle them however you'd like.
I am creating an app with Accessibility Service and I want to do some task when the back button or home button is pressed.For that purpose I added the following attribute in xml file:-
I added the flagRequestFilterKeyEvents flag.
Also set android:canRequestFilterKeyEvents="true".
The service is responding in other devices except the nexus device.
I am not able to understand that, why its not responding in nexus phones.
please share your knowledge with me.
Back button and Home Button are not keys. The actions may be implemented this way on some platforms (for example the back button could send the "escape" KeyEvent). But, this is NOT required.
In this case "KeyEvent" refers to a hardware keyboard (ex: a bluetooth keyboard). Note: software keyboards can be implemented to send these events as well, but they are not required to, and it should not be relied on.
On Nexus Devices, the back and home buttons are actually on screen software buttons. Thus, like the difference between a hardware and software keyboard, those events are not passed through the system in the same way as devices where there are physical back buttons to press.
I want to create an app that is not usable by the user but performs some functionality outside the app, the app just run in the foreground and listen to the press of android hardware/software buttons, the likes of Power button, home button, volume up and down. It triggers a call when for instance, the volume up button is pressed down for 5 secs and notification appears.
I have checked solutions like this
Intercepting the back button
How to override the behavior of the volume buttons in an Android application?
But this solutions have something to do with the user accessing the app directly, i mean to perform this functionalities you have to be on the app which i don't want.
The app was suppose to be run on a smart watch which runs android OS. I was thinking if i can perform this on android phone, it should be easier on the smart watch.
Note:
The App is for targeted users, who will be trained to understand that behavior.
I have a feature in my cordova app that lets user do something when user shakes the phone (I'm using shake.js for the purpose). The phone vibrates when it happens.
The problem is that, when I "alt tab" away from the app and it's in the background, the shake/vibrate combo still works. So the user might be using a completely different app and the phone would still vibrate.
Is there a way to detect that the app is in the background, or better yet, freeze the app somehow when it's going to the background?
I have this problem on Android (haven't tested it on iOS yet).
You can simply bind the pause event and you remove the shake feature from your app.
According to the documentation The (pause) event fires when an application is put into the background.
You can listen for the resume event to put back the shake feature.
As usual in the documentation you can find complete code examples.