Re: [android-developers] Re: Home screed Widget crash
Thank you guys. I fixed it without using the alarm manager :) . What i was doing wrong is that i was creating bitmaps and sending them off to be displayed on the remote widget, thinking that it's memory would be reclaimed when the next image takes its place. Apparently, this wasn't happening. So i limited the scope of creation of the remoteViews to the function in which the widget was updated each time, downloaded images within the same scope and it works like a charm :) no memory issues now. On Thu, Feb 2, 2012 at 8:49 AM, David Ross wrote: > I would suggest using AlarmManager for your repeating 15s update. > Handle the Intent in a private BroadcastReceiver inside your > AppWidgetProvider. Forget the Service as the scheduling mechanism but > use it for the download of the next image from within your > BroadcastReceiver. In BroadcastReceiver also (re)set the next alarm in > AlarmManager to give the "forever" 15s repeat. Services can be killed > basically at any time unless they are bound to a Notification but who > wants a Notification if the Widget is on the screen already? Check > your log, you might find the system is killing the Service. > > Then, handle Screen On/Off Intents so you only do your downloads when > the screen is on. > > > On Feb 1, 5:27 am, String wrote: > > The failed binder transaction issue basically happens whenever you send > > data "too fast" to an AppWidget, where "too fast" is loosely defined. You > > can definitely cause it by sending >1MB at once, but you can also get it > by > > sending much smaller quantities at too fast a rate. Which is what it > sounds > > like you're doing. > > > > Your best solution is probably to create a content provider and have your > > widget access that directly for the images, which will avoid the > > RemoteViews (and thus the binder which is causing the problem). A Google > > search for *image content provider* should get you started. > > > > Having said all that, updating an AppWidget with an image every 15 > seconds > > sounds like a recipe for battery drain. You might want to test that > > hypothesis, see how bad the power drain is before you go to the trouble > of > > re-implementing the image delivery mechanism. You may need to rethink > your > > concept at a deeper level instead. > > > > String > > -- > 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
[android-developers] Re: Home screed Widget crash
I would suggest using AlarmManager for your repeating 15s update. Handle the Intent in a private BroadcastReceiver inside your AppWidgetProvider. Forget the Service as the scheduling mechanism but use it for the download of the next image from within your BroadcastReceiver. In BroadcastReceiver also (re)set the next alarm in AlarmManager to give the "forever" 15s repeat. Services can be killed basically at any time unless they are bound to a Notification but who wants a Notification if the Widget is on the screen already? Check your log, you might find the system is killing the Service. Then, handle Screen On/Off Intents so you only do your downloads when the screen is on. On Feb 1, 5:27 am, String wrote: > The failed binder transaction issue basically happens whenever you send > data "too fast" to an AppWidget, where "too fast" is loosely defined. You > can definitely cause it by sending >1MB at once, but you can also get it by > sending much smaller quantities at too fast a rate. Which is what it sounds > like you're doing. > > Your best solution is probably to create a content provider and have your > widget access that directly for the images, which will avoid the > RemoteViews (and thus the binder which is causing the problem). A Google > search for *image content provider* should get you started. > > Having said all that, updating an AppWidget with an image every 15 seconds > sounds like a recipe for battery drain. You might want to test that > hypothesis, see how bad the power drain is before you go to the trouble of > re-implementing the image delivery mechanism. You may need to rethink your > concept at a deeper level instead. > > String -- 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
[android-developers] Re: Home screed Widget crash
The failed binder transaction issue basically happens whenever you send data "too fast" to an AppWidget, where "too fast" is loosely defined. You can definitely cause it by sending >1MB at once, but you can also get it by sending much smaller quantities at too fast a rate. Which is what it sounds like you're doing. Your best solution is probably to create a content provider and have your widget access that directly for the images, which will avoid the RemoteViews (and thus the binder which is causing the problem). A Google search for *image content provider* should get you started. Having said all that, updating an AppWidget with an image every 15 seconds sounds like a recipe for battery drain. You might want to test that hypothesis, see how bad the power drain is before you go to the trouble of re-implementing the image delivery mechanism. You may need to rethink your concept at a deeper level instead. String -- 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