Hi everybody, I'm developing an Android application that runs a background service. This service must launch and activity when an incoming XMPP event is received (we're using smack.jar library for android).
I'm facing some issues when launching the activity if the phone screen is locked. To solve them, I'm using KeyguardLock and WakeLock classes to "wake up" the device when the XMPP event is received. I'm doing it this way: KeyguardManager.KeyguardLock kl = km.newKeyguardLock(TAG); PowerManager pm = (PowerManager)getSystemService (Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK| PowerManager.ON_AFTER_RELEASE|PowerManager.ACQUIRE_CAUSES_WAKEUP, TAG); wl.acquire(); kl.disableKeyguard(); wl.release(); The strange thing is that, when the screen is locked, the first time this code is triggered, it works quite well, the screen is unlocked and the activity is shown. However, the next times this code is executed, the screen does not unlock (only flash when the wl.acquire() method executes). I don't know if I'm missusing the wakelock flags, so I'd like to receive some feedback of android experts :) The another issue is when using a NotificationManager in order to play a sound when a XMPP event arrives. I'm using this code: NotificationManager nm = (NotificationManager)getSystemService (Context.NOTIFICATION_SERVICE); Notification notif = new Notification(); notif.defaults |= Notification.DEFAULT_SOUND; nm.notify(1, notif); When this code executes, the application launch this error: 06-22 09:17:11.347: ERROR/MediaPlayerService(542): Couldn't open fd for content://settings/system/notification_sound 06-22 09:17:11.416: ERROR/MediaPlayer(569): Unable to to create media player 06-22 09:17:11.480: WARN/NotificationService(569): error loading sound for content://settings/system/notification_sound 06-22 09:17:11.480: WARN/NotificationService(569): java.io.IOException: setDataSource failed.: status=0x80000000 I've seen the same problem in this thread http://groups.google.com/group/android-developers/browse_thread/thread/c6e375859329807d/58827d969cb5e1ab?lnk=raot, and don't know if it is a bug of the 1.5 SDK. Any advice will be welcome. Regards, Mario. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---