Thanks. I'll keep looking for a solution then! On Friday, July 20, 2012 11:04:13 PM UTC+1, Kostya Vasilyev wrote:
> Yep, I can confirm this with my own foreground service on 4.1.1 (Galaxy > Nexus). > > -- K > > 2012/7/21 Andy dev <andrewpmo...@gmail.com> > >> Anyone at least confirm what I'm doing looks ok - even if you don't know >> the reason why. Just as a sanity check? >> >> On Thursday, July 19, 2012 10:19:22 PM UTC+1, Andy dev wrote: >> >>> I've got a service running (an accessibility service called >>> MainRunningService) and also use an alarmmanager within my app. >>> >>> On ICS when a user pulled up the task list and swiped the app away the >>> service kept running, but the user interface was cleared from the stack. >>> >>> On jelly bean I'm finding this to be a little different. It seems like >>> it kills off the service and then restarts it even if I've got an icon in >>> the notification bar and I've got the app set to run in the foreground. >>> This is killing off all my current app state and causing it to stop working. >>> >>> I'm seeing this in the logs >>> >>> 07-19 21:47:42.213: I/ActivityManager(307): Killing >>> 834:com.example.android.**appname/u0a72: remove task >>> 07-19 21:47:42.236: W/AudioService(307): AudioFocus audio focus >>> client died >>> 07-19 21:47:42.236: I/AudioService(307): AudioFocus >>> abandonAudioFocus(): removing entry for android.media.AudioManager@** >>> 41a42020com.example.android.**appname.service.** >>> MainRunningService$1@41963ec0<android.media.AudioManager@41a42020com.example.android.appname.service.MainRunningService$1@41963ec0> >>> 07-19 21:47:42.244: W/ActivityManager(307): Scheduling restart of >>> crashed service >>> com.rageconsulting.android.**appname/.service.**MainRunningService >>> in 5000ms >>> >>> For the persistent Icon I'm doing the following: >>> Notification foregroundNotification; >>> foregroundNotification = new Notification(R.drawable.iconx,**"Example >>> starting notification",System.**currentTimeMillis()); >>> Intent i=new Intent(this, MainUIActivity.class); >>> i.setFlags(Intent.FLAG_**ACTIVITY_CLEAR_TOP|Intent.** >>> FLAG_ACTIVITY_SINGLE_TOP); >>> foregroundNotification.flags|=**Notification.FLAG_NO_CLEAR; >>> startForeground(9642, foregroundNotification); >>> >>> >>> >>> Is there something I'm doing wrong? I've never had a problem in the past >>> with this code, but it's not very good on jelly bean. >>> >>> >>> >> -- >> 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 >> > > -- 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