I have created a Lock screen and i want to show the notifications of messages,missed call etc on the lock screen for example if i received 2 messages and 3 missed calls then it should display on lock screen.
Anyone please tell me how i can do this?
you can use App Widgets which can also be displayed in the lock screens (maybe not all types).
Consider the android:widgetCategory="home_screen|keyguard" property.
See these
App Widgets
you can make use of flag FLAG_SHOW_WHEN_LOCKED
and This great example by google.
Hope this helps.
Related
I'm trying to display a view that the user must dismiss each time they unlock their phone (it's intended to be annoying). It should be able to take a small amount of keyboard input, save it, then return to the previously open activity. I tried having a BroadcastReceiver listen for ACTION_USER_PRESENT and launch my own activity, but then I found out we can no longer listen for implicit intents, or have background services launch activities.
I'm not an Android developer (just trying to build something for my phone), but I did some looking, and I see a few options:
Display a full-screen intent. I think something like scheduling a job to raise a notification whenever the phone is locked, so that the notification appears first thing when they unlock the phone.
Use SYSTEM_ALERT_WINDOW and draw my view as an overlay whenever the phone is unlocked. My only concern with this is how apps like Twilight (which I believe draws an overlay to redden the screen) might interact with it. In those cases, I'd like my overlay to appear at the very bottom.
Are either of those options viable or recommended? Any other suggestions or approaches for how I could accomplish this would be greatly appreciated too. I'm just looking for some guidance on what direction I should pursue.
I'm writing a Kiosk app that, along with having some UI elements, also has a service that sits around in the background while the user explores other features on the device, and wish to re-launch the UI portion of the kiosk when the user has walked away. I figured that the most reliable way to do this is to listen for the screen to go dim and react to that event. However, I'm not seeing anything in the documentation about a system wide broadcast that I can listen to that the screen state has changed. Curious if I'm just overlooking it, or if it doesn't exist.
Take a look at this answer:
android.intent.action.SCREEN_OFF
FYI there is a full list of broadcast intents available in your sdk/platforms/android-xx/data/broadcast_actions.txt if you want to have a look. I found these two quickly, which led me to the answer I linked:
android.intent.action.SCREEN_OFF
android.intent.action.SCREEN_ON
I'm writing an Android app that mostly communicates with the user via status bar notifications. However, I would like to not bother the user if s/he is not really directly interacting with their phone. For example, if the user is using the navigation app or watching a movie. I think that the commonality between all (or most) of these kind of apps is that they keep the screen on. I believe an app can keep the screen on by using a WakeLock or by specifying a keepScreenOn parameter on their activity, there might be other ways.
I wanted to know if, before I am about to show a notification, I can check if another application is keeping the screen on so I can avoid bothering the user. I'd like to cover all options. I can see that WakeLock has an isHeld() method, but will that detect the other method?
Thank you,
I think the best you can get is PowerManager.isScreenOn();
Acquire screen bright wakelock with ACQUIRE_CAUSES_WAKEUP flag. U have to acquire this wakelock bcoz it will force the screen to turn ON if its not. Even if the screen is already ON, one can not guarantee it will remain ON till ur application is running unless u acquire the wakelock. Dont forget to release the wakelock when u r done.
I think you can just post notifications on status bar regardless of state - applications requiring full user attention will typically disable display of status bar altogether -
so no harm will be done by your updates.
I'm using DevicePolicyManager to make an app that can lock devices and was wondering if there was a way to show a custom message on the lock screen if I lock the device with DevicePolicyManager.
There should be a way to show some kind of Activity above the Log-Screen (like the Winamp-App does it).
I found the FLAG_SHOW_WHEN_LOCKED-flag which seams to do just that.
Also, I found this recourse which illustrates how this works.
My customer want a screen-saver for android, I use the
KeyguardManager
Intent.ACTION_SCREEN_OFF
Ref: http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/
When the Intent.ACTION_SCREEN_OFF received, my activity really started. but the screen is off, so I can not see nothing, What I really want is the sreen-saver UI will show on screen.
Is there a way to control the screen on/off programmtically?
You should see Coding for (Battery) Life Google IO presentation, slide 16 for keeping screen on
see if this helps
http://www.androidsnippets.com/stop-screen-from-dimming-by-enforcing-wake-lock