This looks fragile - it depends on the service to keep running forever, which is 1) a bad idea 2) may not last long, especially on Android 2.0 and later.

It also does not help if the Launcher is kicked out of memory, which is a rare event, but does happen sometimes.

My preferred solution is to always push complete, self-sufficient, RemoteViews to the widget, with all the data (like text views) and pending intents.

-- Kostya

05.05.2011 5:47, Niall ?????:
Ok. I was wrong in my first post about the error not being displayed. The appwidget did indeed just default to the initial value.
I solved the issue (I think) by doing the following:

    public static class orientationDetectionService extends Service {
      @Override public void onStart( Intent intent, int startID ) {
      }
      @Override void onConfigurationChanged( Configuration newConfig ) {
        Intent intent = new Intent( this, widget.class );
        intent.setAction( widget.FORCE_WIDGET_REDRAW );
        sendBroadcast( intent );
      }
      @Override public IBinder onBind( Intent arg0 ) {
        return null;
      }
    }


I context.startService'd in the onCreate of the widget, and put the service into the manifest too.

Is this a heavy solution to the problem? It might be a naive question, but will this solution eat away battery?
--
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


--
Kostya Vasilyev -- http://kmansoft.wordpress.com

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

Reply via email to