tags:

views:

326

answers:

1

Hi!

I'm just wondering if I do this correctly; I'm programming a notification app which can display a notification when the phone is sleeping

  1. Disable keyguard lock
  2. Aquire a wake lock
  3. show notification
  4. Set alarm for timeout and reenabling keyguard and release wakelock is the user dont touches the screen. 4.1 User touches the screen, and I disable the timer. Do nothing more. Done and done 4.2 User dont touch the screen, so reenable keyguard and release wakelock. Phone sleeps again

Basically I'm wondering about point 4.1 the most. cancel the pendingintent for the alarm, and do nothing more? or should the keyguard and wakelock that are set be dealt with in some way?

A: 

Locks are global and when one appplication acquires it it will be off until the lock is released. You should always reenable locks. Otherwise system won't go sleep or lock from Home or any other application

EDIT: I'm not really shure how it works with keyguard :/

skyman