Android: get other app's selected text - android

Is it possible to get "other app's" selected text?
Want to created an translation service.
When called, the service will automatically translate the selected text in the front app.
If not possible for non-rooted devices, is it possible for rooted devices.

On Android 6.0+, the appropriate way to do this is to support ACTION_PROCESS_TEXT. This will add your app to the floating action menu that appears when the user selects text, and the user can elect to launch your activity to let you translate that text. Note that Google themselves already has an app (Translate) that does this.

Only if you're the keyboard. Otherwise there's no API for this.
I'm actually toying with doing something similar- my plan was to do it as an accssebility service. So the user would tap on something, we'd get the description from that app, and then translate the description. Basically a screen reader that does translation.

Related

Using testcomplete to determine if a mobile app used the correct icon

I just started using TestComplete and have a technical question for the experts out there. My mobile app has an icon that changes based on state (pressed, not pressed, disabled, etc). What I would like to do is be able to have a keyword test (ideally) to determine if the app is displaying the correct icon. I can start the app and press the icon just fine so I believe I have the app instrumented correctly.
I would suggest using a region checkpoint to validate that the correct image matches the state of your button.
[https://support.smartbear.com/testcomplete/docs/testing-with/checkpoints/regions/creating.html][1]
Please let me know if this doesn't help!

Android: overlay app that can grab text from the underlay app?

Is it possible to have an app overlay on another app and be able to grab text from it. If I had a browser opened and have an app that can grab text from the website and placed into text to speech, is this possible or is there something similar to this?
TalkBack is an app which uses android accessibility services to read out the text underneath when a user touches it. So you can also make your own accessibility service.

Android Open Context Menu Whenever i select any Text anywhere across the device

I am trying to work on one idea. whenever user selects any text anywhere in any application' on android device i want to show one option to user just like we get an option for copy.
Is it possible to change android's default behavior like this. When user selects any text i want to show one option just like "copy" and when user selects that option i want to perform some operation on that selected text.
Any idea how can i achieve this ?
Is it possible to change android's default behavior like this
Not from Android 1.0 through 5.1.
The M Developer Preview offers a means of doing this. Activities supporting the PROCESS_TEXT action will show up in the floating action mode that appears when users select text:
However, as this is not well-documented, it remains to be seen if this will make it into the final edition of Android M.

Can an Android app interact with another app?

I want to be able to tap the statusbar and the contents in the displayed app to be scrolled up to the top.
Is it technically possible that an app intercept my tap and send the appropriate command to the active app? I have noticed for example that AntTek quick settings shows a drop-down window when swiping down from statusbar. While using the app I did also notice that even by just tapping the statusbar (before beginning to move the finger down), the app seems to already interact with the touch as it dims the screen brightness in preparation to display it's "window" (sorry I use the MS Windows term), so clearly a statusbar tap CAN be sensed by an app.
Starting from this, I wonder if such an app could then send a message to the active program telling it to scroll up.
Is that possible? And if yes, the message must be customized to a particular app (let's say the browser as the most important) or is it standardized so the apps speak the same language between themselves?
I am not a programmer so answers with codesamples might be less helpful than a plain english explanation. Finding out that is possible would lead rather to pursuing a programmer to implement the idea rather than starting to develop it myself.
Thanks :-)
There is an XPosed-module which seems to do exactly what you want.
To use XPosed-modules, you'll need to root your phone and install the XPosed-framework.
The XPosed-module is called "Statusbar Scroll to Top" and its repository can be found here:
http://repo.xposed.info/module/com.mohammadag.statusbarscrolltotop
This will work for almost all app-lists, but for example won't work for browser-content.
If you want to scroll to the top of the page in a browser, then you'll probably do best to get a browser which can do that on its own. (For example Habit Browser has it built-in and respective plugins are available for Firefox.)
Yes it is possible. HiroMacro and Frep can do this, but it requires root. https://play.google.com/store/apps/details?id=com.prohiro.macro&hl=en
(how do they simulate mouse and keyboard interactions on other applications? i have no clue :/ anyone?)
Is it technically possible that an app intercept my tap and send the appropriate command to the active app?
No. One app cannot send fake input to another app, for security reasons.
An android app comprises of several activities. Each activity display a GUI that allows the user to perform a specific task. To take the user from one activity to another, app must use an Intent to define our app’s intent to do something.
An intent can be explicit in order to start a specific component (a specific Activity instance) or implicit in order to start any component that can handle the intended action.
Interacting one app to other app in android
google docs link

Replacing/modifing the text selection method (long press, handles) in Android with a different one?

I have an idea how to enhance the text selection (long press on a word select it, with two handles you can correct the selection) on Android for an academic project. I don't see a problem with coding the logic from this enhancement, but as I'm new to the Android world I'm pretty lost how to integrate it into the OS. I'm very certain that I have hours of reading the API before me, but I wouldn't mind to lighten the jungle a bit. That's why I asking here.
In a nut shell:
I want to implement an own text selection gesture that should replace the current selection method (long press on a word select it, with two handles you can correct the selection) in the browser and PDF reader. Actually one can say if possible system wide. My first idea is to make an App that overrides the current behaviour.
Is it possible to replace the current test selection mechanism system wide? In other words, is there a way to override the given text selection behaviour with an own App? Like you can change the keyboard with a different one(swipe keyboard, SwiftKey X, etc.). Or is it not possible to modify Android on such a low level with an App?
Which packet or classes in Android are responsible for the text selection?
I'm very thankful for every hint on that topic.

Categories

Resources