Using getRunningAppProcesses() with the .get(0) method does not give the activity currently in pip, instead returns the one in foreground. How do I get the process/ activity/uid associated with the application using pip mode. (picture in picture)
I am creating a service with elevated privileges to monitor currently running processes.
Related
If I'm writing my own Android app, I know how to structure it as a Service so it will start running in the background.
However, is there a way to launch an existing app (for example, any random .apk from the Play Store) so that it starts up in the background, without its screen taking over the display?
Alternatively, I'd be willing to launch the app, force it into the background, and redisplay the window of the previous app (whatever it might have been) that was running in the foreground. I don't know how to programmatically put the current app in the background and then determine the previous app and bring it back to the foreground.
I'm willing to do this any way possible: via Java, via one or more command-line utilities, via a Tasker plugin, via an Xposed module, or whatever.
Thank you in advance for any pointers to docs or any suggestions.
I discovered that the #0 entry of "dumpsys activity recents" gives the currently displayed activity ... at least on my rooted Marshmallow device. This gives me what I need.
My application has 2 different possible launch scenarios : standalone or launched by another app (with specific intent).
If launched in standalone mode after it is launched by another app, my app is completely broken (I deal with bluetooth, etc).
Is there any way to know when my app is launched from another app whether or not my standalone app is already running on the device?
I want to write an application that can prevent some application from launching. My requirement is to block some application for some period. So what is the way to block or prevent others application from starting or launching through my application.
My question is -- Is it possible to prevent launching other application from my application? If yes then what is the way.
I tried killing the running application. But it only kills when the application is in the background. When the application is in opened state(displayed on the screen) the killing of the application is not working.
So what is the way to block or prevent others application from starting or launching through my application.
Write your own home screen, so you are the one doing the launching, and implement your launching rules there.
This will cover basic scenarios. It will not help with:
Stopping apps that are launched via notifications (e.g., in response to an incoming SMS)
Stopping apps that are launched via other things in the system bar on tablets (e.g., some tablets let you get to the Settings app from there)
Stopping the user from rebooting their device in safe mode and getting rid of your home screen
The only way to handle those scenarios is to create your own ROM mod with adjustments to the operating system, then distribute that ROM mod (e.g., on your own devices).
I am a newbie on android apps development, I want to make a application which can lock any application when started. For eg if someone opens chrome or any other application it simply locks it.
Maybe you will not get any straight forward solution for that.you have to create a service that will run on the background.You can check periodically to find therunning process.Then you can find the package name for the process which you want to kill.Finally use killBackgroundProcess of the ActivityManager to kill the process.This method only kill background process.So if you want to stop browser that starts running simply send that in background(If you bring your activity in foreground it automatically will be back) and run the killBackgroundProcess(pkgName).
Android now allows users to add app widgets to the lock screen form API level 17, i dont know backward comparability supports or not
Is there any way of running 2 (or potentially more) applications on the emulator at the same time?
I have an application that obtains its data from another application, therefore I want to modify data in application A and then see how application B handles it.
I'm intending to have some kind of "slider" on application A, therefore I need them both to be running at the same time to see the "slider" on application B update.
You can't have UI threads of two applications running at the same time, but if one of your apps has a background service, that can be running while the UI thread of the other is active. This service could put a notification in the status bar to signify that the data has been updated (actually, I think it's now required that a background service have something in the status bar anyway).
I believe you can also create a "toast" pop-up notification from a background service.
If it's just for testing, your background service can also write messages to the logs which you can see with logcat.
You can use the emulator like a normal phone, so you can run as many apps at the same time as you want. When you say "running", are you talking about "debugging"? You can install any number of apps using adb install, or by just running it through Eclipse. Running a new app won't stop the previous one (besides, you can always go to the app menu and start your other app).