Sorry, I know but I got no clue what could be relevant in that case since
it basically works.
When the intent of my alarmanager is send I start my updateservice from the
onReceive funktion of my widget (if my preference activity is not running).
Then from onStartCommand() of the service I simply call my updateWidgets()
funktion which basically looks like this:
private void updateWidgets(Context context, Intent intent) {
AppWidgetManager manager =
AppWidgetManager.getInstance(getApplicationContext());
ComponentName thisWidget = new
ComponentName(getApplicationContext(), widgetProvider.class);
int []appWidgetIds = manager.getAppWidgetIds(thisWidget);
views = new RemoteViews(context.getPackageName(),
R.layout.widgetlayout);
for(int widgetId : appWidgetIds){
// do stuff
manager.updateAppWidget(widgetId, views);
}
stopSelf();
}
does this help?
On Monday, August 13, 2012 8:46:26 PM UTC+2, MagouyaWare wrote:
>
> If you posted the relevant code, then someone might be able to help...
>
> Thanks,
> Justin Anderson
> MagouyaWare Developer
> http://sites.google.com/site/magouyaware
>
>
> On Mon, Aug 13, 2012 at 10:20 AM, f.Audire <[email protected]<javascript:>
> > wrote:
>
>> Hello,
>> I'm developing an appwidget that shows the current batterylevel, but I'm
>> getting some weird behavior on one of my devices.
>> I have an alarmanager running which every now and then checks if the
>> battery level changed. If the level changed I start a service to update all
>> widgets. It works fine in the emulator (4.1) and on my Wildfire S (2.3).
>> But on my Sony Xperia P(2.3) it behaves really strange. For example when I
>> have 2 Widgets running and I change the preferences of these two one gets
>> updated and the other one doesnt until I click on it to start my preference
>> activity and close it. Then it suddenly shows up in the updated version
>> even if the update service is not running. But that doesnt work on every of
>> my widgets, some never update and show up in the blank form even though its
>> id is used in the update service (I show all iD's with a toast as I go
>> trough them). Can this be the Phone's fault?
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to
>> [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en