How to get currently accessibility selected item with Talkback Enabled - android

I am setting up a function that will deliver sounds based on the item currently selected by the Talk Back accessibility service. My issue is that I can not find a way to actually ask Android what has been currently selected by TalkBack.

You can use the android Text-To-Speech Engine(TTS) provided by the system. Using this, you can play the audio of the text provided,on a new message event or whenever user clicks on the text.
TextToSpeech tts=new TextToSpeech(this,this);
String text = "message_text_string";
tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);

I don't know the specific answer for android, perhaps you can, but generally you can't know where a screen reader user is currently looking.
You must make the difference between system focus, and the current reading position. They aren't the same.
When the system focus is moved, for example programatically or when pressing tab on a keyboard, in principle the reading cursor follows.
The converse isn't true when the user reads the page with arrow keys or by sweeping on mobile devices. IN that case, the reading position moves but the system focus stays in place.
You can know where the system focus is at any time (example in JavaScript: document.activeElement), but there is generally no equivalent to know where the reading cursor is.
Philosophically it's very good as it is. If we take a paralel, you have no way to know where exactly the user is looking at on the screen (except with very specific hardware).
For your particular case, the best you can do is probably to base on the system focus to decide whether or not to play sound.

Related

How do you intercept/reroute phone call but have destination number appear correct?

Trying to replicate what Google Voice on Android does. Specifically you dial a number in the dialer, in this case 123-456-7890. Google Voice intercepts the call in a BroadcastReceiver, and reroutes it to a "shadow number (in this case 1-916-538-1453). However it manages to keep "1234567890" as the destination number and displays custom text in the blue box that comes down and then disappears. Does anyone know how you would do this?
After doing more research on this topic and asking people that have worked on this in the past, I have determined that this is basically impossible. As Chris mentioned in the comment, it comes down to having your app be signed with the Google key in order for it to work. The best workaround is to display a toast (possibly custom toast) showing the custom text and the original number and then rewrite the call log to display the correct number.

Is it possible to keep track of record of user interaction from background in android?

I am working on an android application which can be used to capture the sequence of user interaction on android device. Starting from when the device is powered ON.
This is to be done by an application, based on the users event a script (Comma (,) delimited text format) will be generated which can be used further to played back the records of events.The application must have various button to start, pause, stop button for recording, script creation should also work according to button pressed.
Is it possible to keep track of record of user interaction from background in android?
I didn't get anything about this. Any help or suggestion is well appreciate.
The application you are describing is a KeyLogger. Unless you have root permissions you cannot do this. If you could it would represent a huge security gap in android. It would allow any app to capture credit card numbers, passwords, email address, etc...
Your only options are to use root privileges or write a custom android keyboard; however, that will only let you record keystrokes when your custom keyboard is used.
A better question is what are you trying to do, as there is probably a better way to acheive what you want.

Android: Global Key Listener

I am writing an android app which will record the frequency and timestamps of when a user is using their keyboards (soft or hard) (Example: a parent checking to see if their child was texting during school by giving them timestamps and frequency of key presses). This wouldn't need to know what was being typed, just when something was typed. It would also need to function regardless of what app was using the keyboard.
This is not possible, except perhaps via custom firmware.

Quick notification silence

The primary purpose of my app is to change a smart phone into a sort of smart pager (there is an associated web app, but that's not the purpose of the Android app). I use the Notification system built in to Android to handle alerting the user that they have received a page.
My problem is that the clients want:
The notification ringer to ring forever until acknowledged (easily accomplished with FLAG_INSISTENT)
An easy way to silence the ringer with 1 push of a button. It is really not always feasible due to the nature of their work to press the power button, slide to unlock, and drag down the notification bar. I need to replicate the behavior of a pager.
I need to find a way to satisfy the 2nd requirement. It looks like I can hook into keypresses if I've got an activity running, but of course, when a notification is received, the screen will probably be off. I am looking into this currently, but I was wondering if anyone had some guidance in the meantime.
Does anyone have ideas on how I could accomplish this goal? Are there alternative ways to listen for key presses, or some creative combination of flags that could get me there?
Techniques that would normally be frowned on for Market apps are completely on the table, since the phones are owned by my employer and will only be used by other employees. I just want to avoid using private or deprecated APIs to make switching phone models easier for the developer who eventually inherits this project.
Thank you to everyone for reading!
Does anyone have ideas on how I could accomplish this goal?
You'd have to hold a WakeLock, specifically a FULL_WAKE_LOCK, in order to respond to button presses. This means that battery life will be sucktastic, unless you put some time limit on that (e.g., hold the WakeLock for a minute or two, but otherwise assume the user's not near the device, so don't keep it awake).
You would also need to try to interrupt the keyguard with KeyguardManager. I have not done this so I do not know all of the details. Your "watch for the magic button" logic would have to be in the activity that appears on top of the keyguard.
Also, bear in mind that not all Android devices have physical buttons -- in fact, I would not be the least bit surprised if the whole physical button metaphor goes "poof" with Ice Cream Sandwich later this year. Hence, the button in question really should be an on-screen Button for future-proofing.

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