Is there any way to programmatically simulate user input from one android application to another ? I'd like to create android application that will be send commands to another. For example - user touch screen action.
This is only possible using one of these two approaches:
Root your device
Direct injection to /dev/input/eventX
Using InputManager.injectTouchEvent()
Using WindowManager.injectPointerEvent()
Create an AccessibilityService. Notice that this is not guaranteed to work with all third-party apps.
It is possible with AccessiblityService since Android 4.0. Details in my answer to another question.
It is not possible, this would be too high security risk. Maybe add what you actually would like your app to do?
If this is for testing then this can be achived with test framework, for example you can use uiautomator:
http://developer.android.com/tools/help/uiautomator/index.html
Related
I need to create two different applications (two different processes) in Android. One will have activity and the other should just be service which would be started from the activity code.
I need it to be separate because in service I need to create one more instance of SDK that I am using in my activity.
I can't find any example how to implement and connect these two applications, does anyone can help me?
Thanks in advance
I'd suggest not doing it at all. Android is really not set up to be a server, with power limitations and the ability of the OS to kill background processes at any time it just isn't meant to be reliable- which is exactly what a server needs. I would suggest reposting with more details of what you need (because "need to create one more instance of SDK" doesn't make any sense- SDKs don't have instances, and why would you not be able to do more than 1 instance in your Activity) and seeing if you can get alternative architetures.
I have an app that has an activity which allow users to download PDF files by selecting a PDF and clicking the download button.
The issue is: I don't want to always ask users to update the app when there's a new material available.
Is there a way I can update the .java code without always asking users to update the app?
Wrong design point.
You have probably hardcoded the PDF / file names in your Java application.
When these values are supposed to change, then well: don't hardcode them.
Instead you create a server side service that lists the available PDFs. And then your app uses that service in order to acquire that information.
Anything that is "dynamic" must not be hardcoded in your app itself. Instead your app knows how to fetch that piece of information from somewhere.
When the source code of your application changes, your users have to upgrade the app. It is that simple. The other way round: if you know about "changes" to your app that need to work without upgrading the app, then well: you have to design the whole app around that requirement.
A first starting point / further reading: see here.
I'm creating middleware app for android which in main think will allow people create games based on blocks easily. The idea comes from Siftables (sifteo cubes) - I'm creating Android version :)
The idea was to make middleware which contains GUI to display blocks and board, and allow players to move blocks. Middleware is connected with game (another app), which count score and do another basic things. And here comes my question. I want to split display into two parts - one for middleware GUI and second for game e.g. displaying score.
I found Fragments, but everywhere it was used in one application. Is it possible to display two fragments from differen apps at one time?
Thanks, for help :)
Is it possible to display two fragments from differen apps at one time?
No, sorry.
You can use RemoteViews — what app widgets and custom notifications use — to pass bits of UI from one app to another, though RemoteViews are limited.
You could create your own RemoteViews-like system, marshalling instructions for how to build a UI and pass events, then use that between your apps.
On Android 7.0+, the user could enter split-screen mode, showing two activities side-by-side, and you might leverage that for what you are seeking.
You should take a look here:
https://developer.android.com/guide/topics/ui/multi-window.html
But as CommonsWare mentioned, it is only from Android 7.0 officially.
With same hacks, you can use it it lower Android versions too, but root necessary.
Or you have to use manufacturer specific APIs, if it is supported, like on Samsung devices:
http://developer.samsung.com/s-pen-sdk/technical-docs/Designing-For-The-Galaxy-Note-Creating-Multi-Window-Apps
So, I think the best option would be splitting middleware GUI for GUI and part for game, so game would send data to middleware and it would display it.
I'm developing an application where authentication is made with the voice of a user. So it has to be possible to distinguish the users. I know MARF should me a possible SDK, but it's kind of old, so I was wondering of JSAPI can be used for this. It's not necessary to translate speech to text but to distinguish a user for another one.
No you can not recognize speakers with jsapi.
I wanted to know if there is any feature in Android where I could select a word from a third party application and send or share that word to my application. I could store that word in my application for further processing.
Implementing a "share" action is easiest if you are targeting API level 14+ (Android 4.0), as documented here: Adding an Easy Share Action.
If you need to target an earlier API level, the process is a bit more involved, as documented here: Receiving Content from Other Apps.
(Note that while I normally consider link-only answers on Stack Overflow to be a poor choice, the process of implementing "share" actions is somewhat involved and fully documented on the Android developer site. This is a case where simply pointing you at the documentation seems like the most appropriate thing to do.)
Here is Android copy/paste desciption: http://developer.android.com/guide/topics/text/copy-paste.html.
But I don't think there is way to modify 3rd-party app's context menu to add custom option like share, without changing this app's source code or changing Android platform (to add your own sharing mechanism to context menu).