I want to inject a touch event Android Studio during app running at background.
After searching it, I found a couple of solutions but all of them need root rights.
For my private use, I am trying to make a remote control app (like TeamViewer Quicksupport) that streams to my video streaming server RTMP&RTSP and I need to inject tap (via touching) and input (via typing).
Related
I created a messaging app, I want when some user send a message to another user then that user receives notifications badges over there app icon.
It should be work even app is closed or killed.
Thanks in advance.
I tried some libraries of GitHub but not working.
This is not a feature the of Android system. Device manufacturers (like Xiaomi you mentioned) or launcher developers (like Nova Launcher) can implement it and expose an api for app developers, but there is no standard for that, nor is it expected by the users to be there.
I've decided to use a service for the Android Studio app I'm working on; however, I can't seem to find a way to reference the service in my project. The service will enable the mic to continuously record and using a thread, notify the user if the sound is over a certain loudness and then update the phone's location accordingly. So within the service, if the mic listens into something above a certain loudness threshold it will pass the information to the Google Maps activity. The service is a started service that starts after a button in another activity is pressed.
Is there a way to reference the service, possibly a variable within the service, from my Google Maps activity java code? Do I have to use a bounded service instead?
You describing a service that should have connection to ui, notify it about it state and possibly allow changing it. You should you use bounded service for that, they have exactly what you need: https://developer.android.com/guide/components/bound-services
I have built a Java Spring Application. This application in the end after doing its work pushes data to a sqlite database.
Now the functionality that i want to add is: Once data is pushed into db, i want to send a custom notification on an app running on android wear. This custom notification should have a message and some options for user to respond to. Finally on seeing the notification on android wear the user should select one of the options and that should be stored in a database.
As i am new to android development, I cannot understand three things:
1. What kind of android application should i develop?
2. How can this android application receive some message or data from some other service (in my case java application)?
3. How to save user response to database?
Some guidance would be really appreciated.
Thanks
I will try to answer all your questions. If your current Java application is a web app, then you will end up building a mobile/wearable app that will communicate to this web app. If your current Java application is not a web app, you will either have to integrate its logic into the mobile/wearable app directly or turn it into a web app so it can communicate with the mobile/wearable app.
You will end up developing two Android apps, essentially. A mobile app for the mobile device and a wearable app that will communicate with the mobile app. This can all be done in Android Studio and in one project though, so it will basically be one application at the end of the day.
Like I mentioned above, you will have to either integrate that existing application's logic directly into your new Android mobile app, or turn your Spring app into a web app and host it on a server that your Android mobile app can call out to to get data.
Android has the concept of local databases and can actually use SQLite on the device. This is most likely how you would store the response from your service.
In Android, I can monitor if certain events are triggered through the use of Broadcast Receivers. Are there any tools which let me view ALL events on an android device I am debugging instead of having to add a broadcast receiver to listen to them?
For example, in a Broadcast receiver, I can monitor for a call forwarding event. Is there a way to debug such events outside of having to write additional Android code? My goal is to test that certain events are triggered after UI state changes, and I am not seeing anything obvious in Logcat that communicates which events are being fired.
For example,
with call forwarding I only see cases like below in Logcat.
START u0 {act=android.intent.action.MAIN cmp=com.android.phone/.GsmUmtsCallForwardOptions}
The machine where you run an Android remotely can be any system supported by the Android SDK: Windows, Mac OS X, or Linux. The socket connections is forward from a specified local port to a specified remote port on the device instance.
It is recommended that this machine is on the same network as your development PC, for performance and configuration reasons, but it is also possible to use any remotely located machine if firewalls and routing are configured correctly. You have to follow specified steps that provide you with the necessary settings in your environment configuration that will allow you to have remote debugging.
Alternatively you can also consider using Google chrome remote debugging for Android. The jsHybugger can also offers you a similar tool that will equally allow Android remote debugging.
Indeed you can choose the approach that suits you better.
Otherwise, if what you meant is to listen to event in some application, then this has to be done by yourself by hand, including it to the respective app you want to listen for every single event. Further details on this direction you find here:
Android listen for all events in application
As you can see, Android has a lot of capabilities, but everything come at some cost - i.e. you have to code it. Otherwise, something that could be done according to your suggestion would be kind of an App or an API that would monitor every single event from all Apps currently in your mobile. But if this is what you really want, then in my view such approach would be cumbersome and overload your mobile.
i'm trying to build an application that every given time, will connect to a remote server and get JSON object from it.
as i searched the web for answer i wasn't able to realize exactly how to setup a service and run it as long as the application is running.
i want my main.xml screen have some kind of TextView which will update from the service.
couldn't found anywhere how to build a service which update a TextView when needed..
i'm looking for a simple example - as for i'm newbie to android development.
What you should look for -- perhaps instead of a service in this instance -- is an AsyncTask. This is what you use when you need to update the UI from the background and not hang around too long on the main thread. Here's one AsyncTask tutorial, and here's what the Android SDK docs have to say about it.
If you need to do things like download JSON every so often from a server, a Service might be a good solution. To communicate back and forth between a Service and an Activity you will use a Messenger and Handler example. You can find an example of how to use the messenger / handler pattern for services and activities in the API demos included with the SDK (here). this SO thread is also relevant.
If you need to keep your service running every so often, you'll want to look at using an AlarmManager to grab the data, store it somewhere, and then refresh the display in the Activity (perhaps through a database in your app). But basically, if you need to quickly download some stuff and update an Activity, use an AsyncTask, if you need something longer term, bind a service and then communicate back and forth between it and the Activity using a Messenger / Handler pair (or AIDL, but that's more complicated..)
You might be able to use a bound service to achieve it. http://developer.android.com/guide/topics/fundamentals/bound-services.html