Detect when a failed unlock happens - java

I've been looking around for a while to find out what happens when a user fails to unlock the phone.
Basically I'm trying to take a picture if a user fails to authenticate. But all I can find is ACTION_USER_PRESENT - Does anyone know if this is possible?
Thanks

You can't access the login attempts of the android lockscreen.
If you want to build an app that does that you have to create your own lockscreen. However, this is not a "real" lockscreen you can't edit in the android settings. This would be an App which acts like a lockscreen and has the same permissions. Because you can check if a phone is locked, that way the app would activate its own "lockscreen" (which is basically a normal form with many permissions) whenever the phone gets locked (you probably have to deactivate the original lockscreen).
Look into this link, there you have all options regarding the original lockscreen.

Related

how to remove the third permission option

I've already googled this question but haven't found anything yet, so I need your help. How to remove the third option of permission to the memory, because if the user accidentally clicks on it, it will be necessary to go to the settings and allow the permission to the program manually, and since in general 30-40% of users are able to do this, only one will have to reinstall the program .
As people in the comments have said, it is a system dialog and you cannot change it. If you want to help users find your app's settings you can try sending them there.
Also note that according to the docs
Starting in Android 11 (API level 30), if the user taps Deny for a specific permission more than once during your app's lifetime of installation on a device, the user doesn't see the system permissions dialog if your app requests that permission again. The user's action implies "don't ask again."
So you have to deal with permanent denials even if there isn't a dedicated button.

Check if an app has been opened and recive some alert about it

I’m working on an app that can "disable" another apps for a limited time. In the first activity the user can choose which application he wants to disable, then my application needs to check if the chosen apps have been opened. If so, my app needs to detect it and show the “disabled app” activity of my app instead.
My problem is how my app can detect that the disabled app has been opened.
I looked for solutions and found this one and this one, but they were removed.
Thank you!
There is an API you can use to query events about apps (packages) but it requires an additional 'special access' permission . Have a look at UsageStatsManager

Is there a way to detect when a popup window appears in Android

I started a project of a windows program that connects to an android phone and gives the user information
about it, so I want to display all of the popups that appere on the phone. to do this I need the app version of the program to catch them somehow and give me the name of the app that sent the popup and the popup's contant. is it possible?
it would be kind of security issue if any app could do that... you can try with AccessibilityService with some permissions for reading screen/running Activities and checking style of every Activity is this "popup", but note that some of them are just DialogFragments. So I doubt you can recognize "popups" this way in a reliable way. Look for AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED for more info

How do I know if a user has my app installed and opened?

I wish to promote my app. If a user downloads an app, I would like to know if this is downloaded and opened.
How would you go around doing this?
The question is: how would I know if the user does install my app and open it?
I assume that the key part of "downloaded and opened" is the "and opened" part, correct?
You could just have your activity check some database value (for example) to see if this is the first time that the user opened the app. If so, you could just call a Web Service.
You could actually do that to keep usage statistics in general; you'd probably want to have some kind of explicit opt-in from the user first, though.
Android also has a package for capturing usage statistics.

How to lock android buttons/phone from code (screen lock)? [duplicate]

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

Categories