[android-developers] passing bitmap via Intent is broken in 2.3?

2011-06-10 Thread Tony
Hi guys,
I am passing small bitmaps (about 30k each) from time to time, from a
service to a widget (AppWidgetProvider) via Intent, using

this code from service :

Intent intent = new Intent(intentAction);
intent.putExtra(BITMAP_EXTRA, image);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
service.sendStickyBroadcast(intent);

and this code from the widget:
Bitmap newImage = (Bitmap)
intent.getParcelableExtra(SINGLE_WIDGET_BITMAP);

It is working perfectly so far, but currently I am testing the same
app on Nexus One with plain bulid 2.3.4. The intent is never
broadcasted, instead, I am getting  this in the log :

06-10 02:34:59.791: ERROR/JavaBinder(96): !!! FAILED BINDER
TRANSACTION !!!
06-10 02:34:59.821: INFO/ActivityManager(96): Skipping duplicate ANR:
ProcessRecord{406b6970 3175:com./10034} Broadcast of Intent
{ act=SINGLE_WIDGET_VIEW_IS_READY flg=0x1000
cmp=/SingleWidget (has extras) }
06-10 02:35:09.781: WARN/ActivityManager(96): Timeout of broadcast
BroadcastRecord{409c3720 SINGLE_WIDGET_VIEW_IS_READY} -
receiver=android.os.BinderProxy@409f5ff8, started 10001ms ago
06-10 02:35:09.781: WARN/ActivityManager(96): Receiver during timeout:
ResolveInfo{408b5140 LargeWidget p=0 o=0 m=0x108000}

06-10 02:40:00.540: ERROR/ActivityManager(96): ANR in 
06-10 02:40:00.540: ERROR/ActivityManager(96): Reason: Broadcast of
Intent { act=SINGLE_WIDGET_VIEW_IS_READY flg=0x1000
cmp=SingleWidget (has extras) }

Again, it works with other phones with 2.1 and 2.2, but it doesn't
work with Nexus One/2.3.4 build. If  I remove the Bitmap and put some
other parameter instead (like String), it works.

Any ideas? :)





-- 
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


Re: [android-developers] passing bitmap via Intent is broken in 2.3?

2011-06-10 Thread Nikolay Elenkov
On Fri, Jun 10, 2011 at 4:45 PM, Tony t...@smartmobilesolutions.com wrote:
 Hi guys,
 I am passing small bitmaps (about 30k each) from time to time, from a
 service to a widget (AppWidgetProvider) via Intent, using


 06-10 02:34:59.791: ERROR/JavaBinder(96): !!! FAILED BINDER
 TRANSACTION !!!


 Again, it works with other phones with 2.1 and 2.2, but it doesn't
 work with Nexus One/2.3.4 build. If  I remove the Bitmap and put some
 other parameter instead (like String), it works.

 Any ideas? :)


'Failed binder transaction' usually means you are trying to pass
to much data. One way to avoid this is to save your bitmap to a
temporary file and just pass the filename in the intent.

-- 
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


Re: [android-developers] passing bitmap via Intent is broken in 2.3?

2011-06-10 Thread Kostya Vasilyev
The logcat says that the receiver timed out - took more than 1000 ms.

Perhaps for some reason your receiver crashes or takes too long on 2.3.4,
after getting the bitmap?

Is there anything else in the logcat, like onReceive crashing? If not, you
could put a try / catch block around your onReceive and log any exceptions
(don't think they always go into the logcat for a receiver).

Changing the extra to a string probably causes your receiver not do some of
the things it does, hence a different result.

-- Kostya

2011/6/10 Nikolay Elenkov nikolay.elen...@gmail.com

 On Fri, Jun 10, 2011 at 4:45 PM, Tony t...@smartmobilesolutions.com
 wrote:
  Hi guys,
  I am passing small bitmaps (about 30k each) from time to time, from a
  service to a widget (AppWidgetProvider) via Intent, using
 
 
  06-10 02:34:59.791: ERROR/JavaBinder(96): !!! FAILED BINDER
  TRANSACTION !!!

 
  Again, it works with other phones with 2.1 and 2.2, but it doesn't
  work with Nexus One/2.3.4 build. If  I remove the Bitmap and put some
  other parameter instead (like String), it works.
 
  Any ideas? :)
 

 'Failed binder transaction' usually means you are trying to pass
 to much data. One way to avoid this is to save your bitmap to a
 temporary file and just pass the filename in the intent.

 --
 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