Simulate the winKey press event in android - android

I'm using a bluetooth keyboard with an android tablet and i've found that there's some shortcut avaible from a qwerty keyboard. I want to generate some of them from the code. I'm able to trigger the majority of all the key combination but I'm not able to trigger a winKey (The windows logo key on a qwerty). I've basically try every KEY CODE from android and non of them want to work.
If any one as a little hint on that subject that would be appreciated.

Related

How to set physical button to run app in android custom rom

I've got new mobile from ebay, Blackview bv6000, which has 3 special physical buttons
Camera
Sos
Ptt
Then i need to assign those buttons to run my app and some functions
I got stock rom from Blackview forum, after i extract system.img file and found
\usr\keylayout\Generic.kl
which contains list of key function that i need
key 212 CAMERA
...
#[AGOLD][2015.04.08]Fengjun merge
key 249 FUNC1
key 250 FUNC2
#[AGOLD]End
The question is how can i assign that key to run my app or function in my app?
Edit
More info:
I want to catch button event in home screen or in other app or even the screen is off
Look into KeyEvent which is shown in an functioning example in this answer. For the specific keys, check out https://developer.android.com/reference/android/view/KeyEvent.html
For example, KEYCODE_CAMERA for the camera button.
In my company we have been searching for this for a while and finally I have an answer.
We have recently contacted with the BV6000 main provider and they told me that those buttons can only be overrided by customizing the hardware specifically for your app and that they require a 500+ phones commercial order to start the procediment of customizing something.
They won't move a finger neither give any documentation for less than that :-/

Dynamically communicate with Android soft keyboard

I am developing an simple game using soft keyboard where people play with characters. So I want to change the background color of keys during the game. I know that there are tones of tutorials and questions out there answering to changing background and color of keys but my question is a bit different. Because I want to do it dynamically and I have had a hard time to figure out that how can I do it. I am using Android soft-keyboard but I don't know where and how can I add a listener to change the corresponding key's background. And how my game-engine sends this signal to the keyboard? Could you help me what should I do?
Thanks
Changing the appearance of the soft keyboard from your app will likely be impossible, especially on a per-key level as you describe.
The most feasible option would be to create a custom keyboard specifically for your application.
You could possibly get in touch with the developer of a keyboard app but it's unlikely they'd be willing to add a back door just for your game- and even if they were, your users would then be required to install that keyboard to play your game, which is not ideal.

Simulating arrow key presses in android

I am currently working on an app that simulates the d-pad (up, down, left, and right). The problem is that I can't figure out how to send those key presses to other applications.
Currently, I am using Instrumentation and it works perfectly fine in the activity of my app.
Here is the snippet of the arrow key left code:
new Thread(new Runnable() {
#Override
public void run() {
new Instrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_LEFT);
}
}).start();
The problem with this implementation is that due to an android security feature, I cannot send key presses to other applications.
After searching up different ways to injecting key presses, I came across this article. However, after trying the example code, it doesn't seem to work. I poked around and found out that android doesn't seem to have an input device for the keyboard. When I scan for different input devices, I get stuff such as orientation sensor and etc. Here is a pic of all the input devices on my phone (T-959 Galaxy S).
As you can see, none of these devices is a keyboard. I have a feeling that this is because my phone does not have a physical keyboard. (cypress is the capacitive keys, aries is the volume buttons, and mxt224 is the touchscreen controller)
After a bit more of research, I found that the accessibility api in android has limit capabilities for injecting events, but those are only very basic things such as switching view focus and etc (AccessibilityNodeInfo). However, I have a feeling that I might be able to extend it to support arrow key presses.
So currently, I am very confused on where to go. Has anyone ever done anything like this before? It seems that the simple injection of arrow keys (nothing else) is very frustrating due to the security features in Android. All suggestions are welcomed.
EDIT: I might not have been very clear, but I am fine with building this for rooted phones only. Only requirement is that this app has to run standalone on the phone without being hooked up to any external keyboards via otg or the computer via adb.
I wanted to simulate DPAD key press events few days back and I did find a solution which has its own limitation.
Arrow key press can be simulated using adb commandinput keyevent <keycode>.
So if you want to simulate a DPAD LEFT key press then use the adb commandadb input keyevent 21.
To reuse this bit of code and scale it forward, I created a standalone swing application where i select the device to which i need to send the key events and I can use the existing keyboard of my computer to type in the keys.[I map the keyboard key codes to android key codes].
I am further scaling the application by including remote and game pad buttons, once done, i'll upload the project on git.
Hope this helps.
IF you intention is to create an application that works on non rooted phones perhaps your best bet is to implement a new InputMethod using http://developer.android.com/reference/android/inputmethodservice/InputMethodService.html

Trigger onFocus textBox Android gwt webapp phonegap 1.1

I'm running a webapp on Android galaxytab.
I have 3 textbox with FocusHandler-s erasing the textbox content onFocus.
This works well but if the user uses the tab, previous or next buttons on the device's keyboard, the FocusEvent is not triggered.
I tried to catch Key events to prevent default action on TAB but the tab key is not triggerd either.
Does anyone know how to trigger a FocusEvent on tab or previous/next key press on an Android device keyboard? (Everything works well in computer's browser even if using tab key the focus event is triggered but not in Android's browser).
While this isn't a fix for your FocusHandler issue, if the content in the textbox that is being erased is a placeholder, perhaps you can benefit from this answer.
Take a look at http://www.m-gwt.com
The library provides placeholders for input elements in gwt.

How can I switch to the Android keyboard "SMS" mode

The default Messaging app in Android (tested against version 2.1) appears to put the soft keyboard in a special mode, where the return key is replaced with an "emoticon key". When you press it you get a selection of emoticons to insert into your message.
(source: futurenet.com)
How do I instruct the soft keyboard to appear in this mode in my app?
This is definitely an imeOption being set immediately on EditText. I don't know exactly which one it is, it doesn't seem to match any of the ones described here. You might be able to use Hierarchy Viewer to help you pin down what the exact options are.

Categories

Resources