I have a Service that is launched from in a widget, when the service
start's it sets a static boolean to either true or false depending if
it's able to connect to a device in my home network.

I have different buttons on my widget performing different task if we
are connected, I also have an alarm that triggers an update at
different intervals ( it sends a specific Intent to the widget ).
Everything works fine, but if I leave the phone long enough it goes
into sleep and when I return the buttons won't send any actions to the
device because for some reason the "connected" boolean has changed
from true to false.

The strange thing is that if we are unable to connect the device, it
prints out "Unable to connect" in the widget. But in this case it
doesn't but the boolean has still changed to false.
Example:

if (mConnection.getConnection() != null) {
                                        CONNECTED = true;
                                        doStuff();
                                } else {
                                        CONNECTED = false;
                                        updateWidget("Unable to connect");
                                        stopSelf();
}

So if the Service has been killed, and is re-launched and unable to
connect the widget would have said "Unable to connect" instead shows a
message that has not been valid for some minutes (and should have
changed when the automated update triggers). I know my
onClickListeners work because one button doesn't send a command but
instead opens up an Activity, and that still works.....

Any ideas for this strange behaviour?




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