Android password screen status - android

How do I get the status of android phone when the lockscreen start to countdown disabled lock?
I know I need some services to use this and even BroadcastListener, and I will put my condition on BroadcastListener.
Sample code:
if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction(){
}
is there an (android.intent.action.) too that I can get the lockscreen status?

You have two options:
See the broadcast intents ACTION_SCREEN_ON and ACTION_SCREEN_OFF.
For Android 2.1 and higher you can use isScreenOn() of the PowerManager.

Related

Does android system send broadcast when the phone is locked?

I know that there is a system broadcast called android.intent.action.SCREEN_OFF, but I want to receive broadcast when user lock his phone not screen off.
I am developing an application that can tell user how long his phones is locked.
I don't see the broadcast you're asking for in the list of available broadcasts listed here https://developer.android.com/about/versions/11/reference/broadcast-intents-30). However, you could use the ACTION_SCREEN_OFF broadcast, and in its onReceive(), use one of the KeyguardManager class's methods to check if the device is locked. The method used would depend on your API version. For example, isKeyguardSecure() supports API 16 and above.

Can Android Companion Device Pairing wake up the Companion App from background upon Bluetooth Connection

I want my app to be woken up when the device finds a specified bluetooth device. The problem is, that after android O you can't register a broadcast receiver anymore to handle that in the background. Having a constant foreground service is also no option for me. Android Auto does this behaviour already I am trying to implement myself.
I found this: https://developer.android.com/guide/topics/connectivity/companion-device-pairing
It says
After the device is paired, the device can leverage the REQUEST_COMPANION_RUN_IN_BACKGROUND and REQUEST_COMPANION_USE_DATA_IN_BACKGROUND permissions to start the app from the background.
Sadly i cant seem to find how this is used and if this even provides what im looking for. I am happy for all suggestions and hints.
There's an option to associate a device using CompanionDeviceManager and register a listener CompanionDeviceService via https://developer.android.com/reference/android/companion/CompanionDeviceManager#startObservingDevicePresence(java.lang.String), then you will receive notifications from the system https://developer.android.com/reference/android/companion/CompanionDeviceService#onDeviceAppeared(android.companion.AssociationInfo) and execute your service in the background.

Detect Device Wakeness In Android

I'm trying to create a service that run in background in android.. That service should work only when the device is on sleep (Means that screen is off)..
I think that can be done using a service but I don't know how to detect if the phone is awake or not.. Any Idea ? Thanks..
For screen on-off state, you can try with ACTION_SCREEN_ON and ACTION_SCREEN_OFF intents, as shown in this blog post:
http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/
From here : How to detect whether screen is on or off if API level is 4?

Android service to receive notification when volume changes

My application runs in the background and gets a notification when the volume on the device changes. The service then has to show a warning message based on the volume levels.
What kind of a service should this be.
Thank you.
For achieving this, you need to register a broadcastreceiver. Take a look at this question:
Android BroadCastReceiver for volume key up and down

Android notification led, receive an event when it changes its status

I need to monitor the status of the notification LED on an android device. I've seen several post that explains how to customize the LED behavior (i.e. Changing LED color for notifications) however I would like to receive an event (using a receiver) whenever the LED changes its status or an app triggers a blink, regardless of which app caused the blink.
Is it possible to receive these event?
If yes, which intent filter should I use to receiver this kind of event?
Thanks!
Is it possible to receive these event?
Definitely not in the Android SDK. A custom Android build packaged as a ROM mod may be able to determine this, at least for OS-triggered uses of the LED. System-level use of the LED (e.g., charging status) may not be visible to Android at all.

Categories

Resources