This question already has answers here:
Android, Detect when other apps are launched
(8 answers)
Detect When other Application opened or Launched
(3 answers)
Closed 23 days ago.
I want to open my app when some other app is opened.
Ex:
I want to open my game launcher when some game is opened and i want to draw over the other app
How can i make this in android studio? If you found any online article or videos attach the link down.
If you want to be notified of the execution of other applications, you must use AccessibilityService, by activating AccessibilityService, your app will be notified whenever a application is executed, this is the simplest and best solution for that.
You can also get permission Appear on top to draw on other apps or start an activity from your app instead of drawing, there is currently no other control solution.
Related
This question already has an answer here:
How can I reliably simulate touch events on Android without root (like Automate and Tasker)?
(1 answer)
Closed 2 years ago.
Im working on an app, which would contain arrays which will have their intervals and I want to run the array so every interval, the app would run in the background and simulate a tap on the screen
Basically, the question is, if I can simulate the tap, and if yes, how
If you are running this as part of an instrumented test, that is very simple:
(need to add UiAutomator for this)
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
device.click(X,Y)
If you want to click on the screen during a normal app run:
check This SO question
This question already has answers here:
How to make an android app to always run in background?
(3 answers)
Closed 2 years ago.
I'm developing an android java application,
I'm stuck on a point of how to run a function in the background even if the app is closed.
My goal is to get the user location every 30 minutes.
Thank you.
You can either use JobIntentService or WorkManager for running the task periodically.
JobIntentService
WorkManager Periodically
You can use Service to get user location while the application is in the background.
And for further implementation you can refer below link:-
https://stackoverflow.com/a/8830135/11625897
This question already has answers here:
Device chooser dialog is not showing up after instant run
(6 answers)
Closed 4 years ago.
I have a real device and an emulator. When i first install the app , the IDE asks me to select between the two but on subsequent runs it does not ask me to choose. How do i get it to ask me every time? I tried clicking on stop app , but the problem persists.
It's very easy. In android studio please click your app name dropdown showing at the top menu then click edit configurations and unselect use same device for future launches
You can change it from Run -> Edit Configuration -> Deployment Target Options
Make sure you are stopping your app before next run. (You can find stop option on the same tools section )
This question already has an answer here:
Custom Lock Screen Implementation Techniques
(1 answer)
Closed 7 years ago.
I need to put my app on the lock screen (android 2.2)!
I think there are two options for do this:
Develop an app to replace android's lock screen. This app whould be called when the off button is pressed.
Insert my app button into android's actual lockscreen, so, my app would work, even if the screen is locked, and eventually, my app could unlock the screen.
I don't know how to do it, but I do know it is possible, since some music players can be downloaded and the music player options are in the lockscreen.
Can anybody help me out?
thanks.
(1) is totally feasible and there are many lockscreen alternatives apps available.
(2) will depend on what lockscreen are you talking about and what is what your app does. Firmware lockscreens do not allow usually widgets in them. At most, they have a method to interact with the call/sms log and the music player, but that's it.
So, unless your app does one of those two, your only option is pretty much (1).
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Lock the android device programatically
I have made a simple Android app with a pin-code/screen lock. The user have to write a password to lock the phone and then repeat it to unlock the phone. The problem is that the user still can press back, home (etc) to exit the app without writeing the code. How can I prevent this?
You can block the back button by overwriting dispatchKeyEvent() in your Activity class, and returning true if event.getKeyCode() is equal to KeyEvent.KEYCODE_BACK. But you cannot block the Home button from going to the home page.
I have heard of some trickery where you register your application as a receiver of the android.intent.category.HOME intent. This would cause the Android OS to load your activity if the user presses the home button. If you can get this to work, you could then load the "actual" home screen if the user has entered the correct password. This approach is likely to behave differently on different devices and Android versions, however, and it probably would do nothing to stop the Hold-Home task list from appearing.
The bottom line is the Android OS has been designed to prevent just the thing you are trying to do: an application should not be able to take control over the phone and prevent other applications (especially the Phone) from running.
It's my understanding that you cannot block the home key as it's a security feature that allows the user to always exit an app. Pressing home will not close the activity however.
the guys who created free "Toddler lock" apk somehow managed to did it - download and see for yourself :)
when you run it, it asks for permission to run as home app and you need to check the box "use as default". To exit from app, you need to press on all 4 corners of the screen. All the buttons but power one are locked. So there is a way for sure to do that!
he explains to users how it works here:
http://www.toddlerlock.com/3.html