Build a simple Keylogger Android Application: Accessibility research for Virtual keyboard

筅森魡賤 提交于 2019-12-05 18:43:34

For now your TextWatcher is not binded to EditText

You should use addTextChangedListener(TextWatcher yourWatcher) on your EditText. Here is my example:

      smsET.addTextChangedListener(new TextWatcher() {

        public void onTextChanged(CharSequence s, int start, int before, int count) {
        Log.d(TAG, "onTextChanged start :"+start +"  end :"+count);}
        public void beforeTextChanged(CharSequence s, int start, int count,int after) {
            Log.d(TAG, "beforeTextChanged start :"+start +"  after :"+after);
        }

        public void afterTextChanged(Editable s) {
                int lastPosition = s.length()-1;
            char lastChar = s.charAt(lastPosition);
            Log.d(TAG, "afterTextChange last char"+lastChar );
        }

    });

In your code it should be like this :

KeyLogEditText.addTextChangeListener(KeyLogTextWatcher );

Each of method included in this Watcher is triggerd by entering every single sign from keyboard. Since you get posistion after input you can easly get character that was entered

To store data you mentioned, SharedPreferences will be faster than DB. (Many writes to DB) If your target is at least api 11 you can simply use StringSet Editor.putStringSet if your target is lower it is also possible, some example : http://androidcodemonkey.blogspot.com/2011/07/store-and-get-object-in-android-shared.html

.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!