I got to know how to copy/paste from command line tool at
Paste text on Android Emulator
adb shell input keyboard text 'foo'
It works very well for ascii characters but it doesn't for multibyte characters.
adb shell input keyboard text 'あ'
Doesn't pass any character to emulator.
adb shell input keyboard text '\u3042'
Shows '\u3042' as it is.
Is there any way to pass multibyte characters to the emulator from command line correctly?
I think there is no way to do what you want.
Digging in the sources, the input command line tool ends up calling KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD), and uses that KeyCharacterMap to map from characters to keys press / release events.
Since KeyCharacterMap.VIRTUAL_KEYBOARD does not cover the whole Unicode range, it is not possible to generate events for a lot of characters.
The latest Android Emulator (v25.3) can support copying & pasting multibyte characters. This was launched with Android Studio 2.3. Take a look at the screen recording of the behavior below...
Related
I am facing same issue as this post on Android: QML TextField text erroneously capitalized on device ... All letters are capitalized for TextField control. I have mixed TextField elements where for example when I set echoNode to password, the letters are not capitalized (no issue), while fields with normal echoMode get the issue, which makes me confident its under control of either Android or Qt code.
I switched to investigate from Android side and found this post My Phone Is Capitalizing Every Word which suggests that this problem occurs only when auto-capitalization is enabled on device... I tested it, turned off auto-capitalization on device and the issue disappeared ...
After some investigation I found that most Android apps are build with auto-capitalization aware code, for example this post Why is my Button text forced to ALL CAPS on Lollipop? show solutions with Android Java code .. I wonder if this is a Qt bug or there is something to control it, for example, with QtAndroidExtras classes? while trying to avoid the use of Qt keyboard, I believe/hope there could be a solution from Qt side.
I have built 2 separate apps using Cordova 6.3.1, and I've noticed a strange bug with the keyboard. The following has only been tested on two separate Samsung Galaxy S6 phones running Android 6.0.1. It only occurs on WebApps, not web pages.
In any text input or textarea, typing a special character will automatically replace the next non-special character typed with the same special character:
1) Type a special character (e.g. *)
2) Type any other non-special character (e.g. a)
3) This character is automatically replaced with the preceding special character (e.g. *a -> **)
I've also noticed that if I type a non-special character followed by a special character, then delete the special character, then type another non-special character. This last non-special character is replaced with the first non-special character.
Crazier things happen if you type a long string of non-special characters ending with a special character and then try this delete some number of times and type a non-special character. I haven't been able to find the pattern though.
Has anyone else experienced this? Is there a workaround? Does this happen on other phones and OSs?
Thanks for your help!
UPDATE:
I tested this on a Samsung Galaxy S4 mini running Android 4.4.2, and it did NOT exhibit the bug.
It is a bug on Chrome WebView, it seems to be fixed days ago. You can check the cordova bug report thread.
I am using the emulator that comes with Android Studio and need to past text between my OSX Yosemite machine and an app in the emulator.
I started my emulator with emulator -avd Nexus_6_API_23
I tried long click Command-V it does not paste
I see How can I copy/pate multibyte characters on Android Emulator? and a few others like Paste text on Android Emulator but they seem related to adb and not the new emulator.
Any ideas pls?
Follow these steps for write copied text:
Open Terminal
Write command: adb devices (it will list the device currently connected)
Select Textbox where you want to write text
Write command: adb shell input text 'Yourtext' (make sure only one device is connected to run this command and that you can also use Single Quotes)
Done!
In a terminal, type
adb shell input text 'my string here.'
This work only you have one emulator or one device connected your PC.
I had the same problem - need to copy text from macOS to a Android Virtual Device (AVD) in Android Studio. I tried the sms or telnet solutions, they worked but not really well for a large sum of text (e.g. a whole page of text with spaces, line feeds and all kinds of special characters).
Thanks to someone who created an Apple script to force input password into the password field when opening an encrypted volume. That amazing script also solved this problem! And its more straight forward in utilizing this script to copy and paste from Mac to an AVD.
I have the Apple script icon always stay on top of the screen (the status bar) so whenever I need to copy and paste, it is just one click away.
Here is a copy of the script (whoever created this, thank you again!)
——————
set numbers_key_codes to {82, 83, 84, 85, 86, 87, 88, 89, 91, 92}
set input to do shell script "pbpaste"
if (input is not missing value) then
tell application "System Events"
repeat with char in the characters of input
try
key code numbers_key_codes's item (char + 1)
on error
keystroke char
end try
end repeat
end tell
end if
——————
Just copy the source text, click on the target location in the AVD, and then activate the script by clicking on the script icon, voilà, everything will be pasted like typing automatically!
Be warned that if there’s a huge sum of characters you are copying and pasting, it may take a few seconds for the script to complete the ‘typing’.
There is a tool to execute a command in the adb console to paste when ctrl + v is tapped. Try it out :)
https://github.com/HknCore/AndroidPaster/releases/tag/1.0.0
This feature is just not implemented. You can create a feature request from the emulator's help page
I have created an input device driver that I use for controlling mouse/keyboard from an app. Everything works so far, I can generate input events for both keyboard and mouse from within the app.
The problem I'm facing right now is that I'm unable to enter special characters that are not on the keyboard. If I want to enter an eszett (ß), I can't just simulate a keypress for my input device.
If I'm not mistaken, key character map files should be able to fix this problem. I could map unicode characters to certain keys and then simulate a keypress for that key and the character would be entered.
I tried this, but it doesn't work and I don't understand why it doesn't work. I copied the Virtual.kcm file and renamed it to represent my devices vendor and product ID. To test, I replaced one line in the file to input an eszett instead of a '0' when the 0 key is pressed:
key 0 {
label: '\u00df' // instead of '0'
base: '\u00df' // instead of '0'
shift: ')'
}
I've made sure that the input device uses the correct kcm file by checking the output of 'dumpsys input':
6: custom-input
Classes: 0x8000006b
Path: /dev/input/event5
Descriptor: ab3fb155bce23398b91099a8f37d5cae61f29d21
Location:
UniqueId:
Identifier: bus=0x0003, vendor=0x1111, product=0x2222, version=0x0001
KeyLayoutFile: /system/usr/keylayout/Vendor_1111_Product_2222.kl
KeyCharacterMapFile: /system/usr/keychars/Vendor_1111_Product_2222.kcm
ConfigurationFile:
HaveKeyboardLayoutOverlay: true
Everything looks fine so far, but when I actually generate an input event using sendevent, it still enters a '0' instead of an eszett.
sendevent /dev/input/event5 1 11 1 (KEY_EV, KEY_0, DOWN)
sendevent /dev/input/event5 0 0 0 (SYNC)
sendevent /dev/input/event5 1 11 0 (KEY_EV, KEY_0, UP)
sendevent /dev/input/event5 0 0 0 (SYNC)
I really expected this to work, but apparently it doesn't. Is there something I'm missing?
What would be the solution to enter unicode characters via an input device using kcm files (or in another way)?
"Android does not currently support multilingual keyboards. Moreover, the built-in generic key character map assumes a US English keyboard layout.
OEMs are encouraged to provide custom key character maps for their keyboards if they are designed for other languages.
Future versions of Android may provide better support for multilingual keyboards or user-selectable keyboard layouts." extracted from https://source.android.com/devices/input/key-character-map-files.html#examples
Notice that in this fragment from the documentation it says that the OEMs are encouraged to provided custom key character maps. So this is a probable cause of your problem.
It is possible that the OEM(original equipment manufacturer) of the device that you are using didn't implement custom multilinguald keyboard support. Since this is not required at this point it is possible that the mapping you want to do is not compatible with most devices since eszett is not part of the standard english keyboard, support for it should not be expected, with the exception that one of the OEMs have actually included support for this in their own implementations of the keyboard(remember that Google do not implements this, the OEM must do it).
I figured out that if you select a keyboard layout different from "standard" in the settings, this layout overrides a kcm file. Even if this kcm file is listed in dumpsys input!
we are developing an android device. its on android 4.4.2. My issue is that i am getting red frame like strip which occur at different frequencies. some come and go very fast. but some stay for some time.
i tried to remove the strict mode in developer option.
i tried to make persist.sys.strictmode.visual to 0 manually also by setprop.
But the red strips are killing my days.Please help me on this.
Dont put it as duplicate. Because everywhere the issue is solved with strictmode value to 0. But for me that solution is not helping..
I know this is a bit late but you can try this:
ADB into the device
(open command prompt and type "adb shell")
Then type the following commands
setprop persist.sys.strictmode.visual 0
setprop persist.sys.strictmode.disable 1
Once complete, restart the machine. It worked for me using 5.0.0.