Ok, I've found out a little more information. It seems that the crash 
doesn't happen when the task is swiped away, it's when one of the broadcast 
receivers tries to fire after the app has been swiped away. It works find 
beforehand, but it's cleared from the task list I'm also seeing this in the 
logs:
 
 
07-21 23:57:40.286: E/JavaBinder(309): !!! FAILED BINDER TRANSACTION !!!
07-21 23:57:40.286: W/BroadcastQueue(309): Exception when sending broadcast 
to 
ComponentInfo{com.example.android.app/com.example.android.app.receiver.SmsReceiver}
07-21 23:57:40.286: W/BroadcastQueue(309): 
android.os.TransactionTooLargeException
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
android.os.BinderProxy.transact(Native Method)
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
android.app.ApplicationThreadProxy.scheduleReceiver(ApplicationThreadNative.java:767)
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
com.android.server.am.BroadcastQueue.processCurBroadcastLocked(BroadcastQueue.java:220)
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
com.android.server.am.BroadcastQueue.processNextBroadcast(BroadcastQueue.java:750)
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
com.android.server.am.ActivityManagerService.finishReceiver(ActivityManagerService.java:13281)
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:346)
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1611)
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
android.os.Binder.execTransact(Binder.java:367)
07-21 23:57:40.286: W/BroadcastQueue(309):  at 
dalvik.system.NativeStart.run(Native Method)
07-21 23:57:40.286: W/ActivityManager(309): Scheduling restart of crashed 
service com.example.android.app/.service.MainRunningService in 5000ms
 
To be honest, I've tried to read about the TransactionTooLargeException, 
but I don't feel any wiser!
 
 

On Friday, July 20, 2012 11:23:11 PM UTC+1, Andy dev wrote:

> 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

Reply via email to