2010-10-20 65 views

回答

0

你可以在talkmyphone中看到它是如何完成的。他們使用Jabber,但它可能對你有用。

+0

我希望我的物理鍵盤基本上可以用作我的鍵盤我的電話,不只是短信。 – 2010-10-20 14:28:27

+0

在過去,我將藍牙鍵盤連接到我的手機,但它已經紮根。它不應該是可能的,在一個非根深蒂固的手機。 – Macarse 2010-10-20 15:10:25

+2

藍牙鍵盤可以在無根音的手機上工作,沒問題 – nmr 2014-12-11 02:46:40

18

雖然這個問題已很舊,我想添加這個答案:

您可以使用adb shell input keyevent KEYCODE RESP。 adb shell input text "mytext"。所有的鍵碼的列表,可以發現here

+2

您也可以使用'adb shell輸入文本「文本」',其中文本可以包含'%s'來表示空格。 – piojo 2014-02-12 11:16:10

5

爲了避免文本參數的擴張/評價(即對特殊字符,如「$」或「;」),你可以將它們包裝成報價是這樣的:

adb shell "input text 'insert your text here'" 
+4

這不適合我。以下(如上所示)工作adb shell輸入文本「insert%syour%stext%shere」 – user985366 2015-03-10 18:47:48

1

正如Manuel所說,您可以使用adb shell input text,但您需要用%s替換空格,以及處理引號。下面是一個簡單的bash腳本,以使該很容易:

#!/bin/bash 

text=$(printf '%s%%s' ${@}) # concatenate and replace spaces with %s 
text=${text%%%s} # remove the trailing %s 
text=${text//\'/\\\'} # escape single quotes 
text=${text//\"/\\\"} # escape double quotes 
# echo "[$text]" # debugging 

adb shell input text "$text" 

另存爲,比如,atext並執行。然後,你可以調用不帶引號腳本...

atext Hello world! 

...除非你需要發送報價,在這種情況下,你需要將它們放在其他類型的引號之間(這是一個shell限制) :

atext "I'd" like it '"shaken, not stirred"' 

enter image description here

相關問題