trigger every key press in android in background - android

i am developing android service and I want to know is there anyway that can let me know what is the user typing every key clicked whatever keyboard he is using
for example if the user clicked the letter 'k' from samsung keyboard, i want my service to know that, I could manage this if the user used my custom keyboard, but I want to know even if he is using his default keyboard. and thank you.

I want to know is there anyway that can let me know what is the user typing every key clicked whatever keyboard he is using
NO, there is no way and it's completely illegal.
However Android let you the opportunity the create a custom keyboard using InputMethodService. Once you have created soft custom keyboard and the user have enabled it then you can track every key of user with the callback method onKey()
Also, let me remind you that this is only for the good intentions like word-suggestions and predictions

Related

Android . Activating my application when some string was entered in some other application

I am trying to create a behavior where entering some string in any application will open my application.
I've tried looking around on how to listen for keyboard press or listening for text change, but I couldn't find my required behavior and I don't want to create a custom keyboard for this.
If this is not possible, what will be a good implementation for lunching my application as fast as possible while in the other application?
Answered before the requirement to "don't want custom keyboard"
The only viable way that I can think of is if the user was using a custom keyboard written by you. Custom keyboards can and do act as key-loggers and therefor could detect any key combination, or written word and allow you to execute your code when your conditions are met.
Rerfer to Creating an input method docs
How to open my app as fast as possible from another application?
Press home, launch your app by clicking on the launcher icon
But assuming you mean without doing that, you'll still need to monitor some event, say volume keys pressed or device being shaken for instance, or have you app be running already in the foreground such as what Facebook messenger does (or used to do, I don't know)
Related questions:
What APIs in Android is Facebook using to create Chat Heads?
Listen to volume buttons in background service?
How to detect shake event with android?
Demo of bubbles

Get software key presses in a service

I'm trying to develop an app that, according to some pattern pressed on the keyboard (like swipe, but not that complex), it will do some action. For example, if the user presses two keys at once, it will do some action. This has to be a service, because my won't have a gui. It will just do the actions. I read that it's not possible, as it would create a security hole, so I'm open to suggestions on how I can tackle this problem. I've thought of this way:
1. Create an accessibility service and get the key events (easy for hard keyboard, but I don't know about the soft keyboard.)
Could you give me any other ideas, or help me on how to get soft key events in an accessibility service?
Thanks!

Phonegap, don't lose input focus when keyboard close

I'm using phonegap for develop a mobile application.
I have a search field (an input) and i use http://loopj.com/jquery-tokeninput/.
So, when i focus my input, the keyboard open, i can write a letter, and my script return (or not) a list of user. (Just like examples on my link)
My problem, when i search something and if i close the keyboard, i lose the input focus, so my list of user is closed.
I need a way to, when i close the keyboard (IOS and Android), keep the focus on my input, and keep the value in this input. I just want to close the keyboard, without other effect..
Ideas ?
I have found a solution, i have disabled the .blur event on the code of jquery token input... Easy !

How does Browser (and some other apps) intercept the Back key before my IME?

I've written an IME that displays some popup windows and closes them when the user clicks Back. It works 99% of the time but some apps (like Browser) are able to intercept the KeyEvent.KEYCODE_BACK before my IME, leaving my popup window stuck open.
According to the docs InputMethodService should receive key events before Activity. I've tested this with an Activity and it works as expected.
I checked the Browser source code and it simply overrides Activity.onKeyDown() and onKeyUp(), which should receive events after InputMethodService.onKeyDown() and onKeyUp().
Why does the browser seem to receive key events in the wrong order? Please help because I don't want to have to add ugly close buttons to all my popups!!!
Thanks in advance,
Barry
Its Activity.onBackPressed(). Be careful when you override the functionality of this button as it can create a very negative user experience if you're doing something unexpected or completely ignoring the back button.
If you're using AlertDialogs or similar for popups you may not need to override the functionality, just setCancelable(true). Touching the screen and the back button will close the dialog.

What is the proper way to reference a user interaction on Android?

I'm currently in the process of writing documentation for an app, and was curious of the proper way to reference a user interaction on screen.
i.e.: To advance to the settings screen, tap/touch/click the settings icon.
Since Android is available on so many form-factors, including TV, is it 'tap' or 'touch' or 'click' or something else entirely that maybe encompasses everything? I've checked some other app docs and they all vary.
Thanks in advance.
The documentation of the SDK (agreed, this is for developers, and not end-users) seems to be using the touch word.
See for example the Handling UI Events section, in which you'll find (quoting) :
This is called when the user either
touches the item (when in touch
mode), or focuses upon the item with
the navigation-keys or trackball and
presses the suitable "enter" key or
presses down on the trackball.
Or :
For a touch-capable device, once the
user touches the screen, the device
will enter touch mode.

Categories

Resources