Remote Input method of Android IME extension

Source: Internet
Author: User
Tags iqiyi

in recent years, Internet TV began to hot, music video tv, Millet TV, recently Iqiyi art is also in the wantonly recruit to do Iqiyi TV, of course, there are more attention to Apple TV. In fact, this trend is very normal, also very reasonable, the traditional simple reception television tv has been too traditional, is the revolution. Music as the representative of the next generation of Internet TV to adopt the Internet marketing method, do not need physical stores, do not need physical factory, just plan, service, online booking, direct courier and other ways to greatly reduce costs, but also can control inventory, prevention of risk. At the same time they all insisted that the hardware does not make money, service charges, more value TV user Object this potential value. More users, do anything convenient, of course, there is a larger concept of smart home.

In addition to Apple TV, none of the other uses Android. But all kinds of internet TV it is still TV, unlike mobile phone, tablet, PC and other electronic products, users from it is a distance, users can not directly touch the screen and other ways to input, so the Android soft keyboard is not good enough input interactive mode. For the English Department of the country, the input of this TV is OK to solve, just through the external keyboard directly input, but for similar to Chinese this need to convert language, it is troublesome. This is because the Android external keyboard can only enter English characters, and the input method cannot get the input of the external keyboard (which only supports the touch soft keyboard character) to convert it to Chinese. This reminds me of the title "Remote Input Method".

A very general scenario is: The TV installed a love kick door remote Input method, the input method connected to the remote phone terminal, and then the user in the remote input program with its own input method (Sogou input method), and then the input of the content in real-time transmission to the program in the TV.



remote Input Method mechanism

The mechanism of the remote input method is very simple: to do a special input method, the input method is no longer by touching the soft keyboard to obtain the input characters, but through the network directly from the other side of the network to get the characters (this character can be in English, can be Chinese, any language can), Then character the word to the application. The core of the input is two: Inputconnection Committext and Sendkeyevent two interfaces, the following code implementation:

   private void SendText (String text) {if (!isshow ()) {LOG.D (TAG, "IME is hidden");    Return        } final Inputconnection IC = Getcurrentinputconnection ();            if (IC = = null) {LOG.D (TAG, "IC null");        Return    }//Send the text of any language, such as Chinese, to the program Ic.committext (text, text.length ());        } public void senddownupkeyevents (int keyeventcode) {inputconnection IC = getcurrentinputconnection ();        if (IC = = null) return;        Long eventtime = Systemclock.uptimemillis (); Send Delete,backspace special input such as delete character, special input is realized by Key, OH Ic.sendkeyevent (New KeyEvent (Eventtime, Eventtime, key Event.action_down, Keyeventcode, 0, 0, keycharactermap.virtual_keyboard, 0, keyevent.flag_soft_keyboard|        Keyevent.flag_keep_touch_mode));  Ic.sendkeyevent (New KeyEvent (Systemclock.uptimemillis (), Eventtime, keyevent.action_up, Keyeventcode, 0, 0,               Keycharactermap.virtual_keyboard, 0, keyevent.flag_soft_keyboard|    Keyevent.flag_keep_touch_mode)); }

Then is the code of the Big Head, Network module: the implementation of LAN Search service, automatic connection, network data transmission.


remote Input Method installation use and source code

The following is my remote Input method interface and the use of the interface

The user installs the Remote IME program on two phones, one of them opens the remote Input method application, the other one selects the input method as Remoteime, and clicks the search button inside, When status becomes connected, the remote Input method application can enter content for the remote input method.

Select the Remoteime IME configuration process:

1) Select the language and input method in setting, then select Remoteime

2) then click the default, will pop up the selection box, continue to select Remoteime

3) then go to any of the required input programs, you can use Remoteime

If you want to know more, you can find my source code for this project on GitHub:

Https://github.com/itleaks/RemoteIme

If only testing, you can directly use the remoteime.apk in the item, the source is only the primary version, you can modify the improvements together.


PostScript:

          This blog will be followed in the next chapter--------the Android Input method extension outside the keyboard Chinese input

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.