How to make a widget that doesn't drain the battery and updates often

by Mark Murphy » Sat, 05 Jun 2010 23:16:06 GMT


Sponsored Links
 


Please consider making that configurable and able to be disabled, as an
improvement over the brain-dead stock news-and-weather widget.


That depends on who is holding any partial WakeLocks. Generally, the CPU
shuts off shortly after the screen turns off.


Frankly, I don't know why the Genie... service sticks around for the
stock News and Weather. It does not appear to be affecting the
thoroughly irritating and non-configurable
change-the-headline-every-five-seconds feature, as that persists even
when I shut down the service via the Settings application.


Conceivably. That application is not open source at this time.


Probably not.

If you are using a WakeLock, double-check to confirm you are releasing
it properly.

Then, use this command to see if anyone else is screwing up *their*
WakeLocks:

adb shell dumpsys power

and perhaps:

adb shell dumpsys batteryinfo

to see who is messing up.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.5 Available!

--



How to make a widget that doesn't drain the battery and updates often

by Kostya Vasilyev » Sat, 05 Jun 2010 23:25:56 GMT


 05.06.2010 15:14, Chister Nordvik :
So is this really the best solution to have a service running in the background? So if someone downloads 10 different news widgets from different companies they end up with a list of 10 services in the "Running services" list?
If this is the case, the user will have to choose which one to keep - so you have your chance here :) -- Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --


Sponsored Links


Other Threads

1. Empty Spinner before first selection

I have a Spinner configured with a ListAdapter that I want it to
initially show as having no selection (I don't want it to default to
the first item in the list). When the user clicks on the Spinner I
want it to show the items contained in the ListAdapter and to choose
one.

I don't want to add a blank option as the first item in my list
because then the empty option shows in the DropDownView, looks lame
and can be selected by the user.

I tried starting with no ListAdapter which gives the correct initial
view, and had planned on swapping in the real ListAdapater when the
user click on the Spinner. But Spinner#setOnClickListener throws an
RuntimeException saying you should use #setOnItemClickListener and
Spinner#setOnItemCLickListsner throws a RuntimeException saying it
cannot be used with a Spinner.

Surely this is a common use case.

How can I make the above happen?

-- 

2. Must pass Context to other classes?

I'm not sure if this is an Android question or just due to my being
new to Java as well. I'd like to use the getString method to get
strings from my resources (R.string.whatever). I see that this is a
method of the Context class, and I can call it directly from within my
main Activity class.

But I also have some utility classes in their own class files and
can't simply call this method from them. What seems to be required is
for me to pass the context (the Activity object) into these other
classes via their constructors. Then I can call the method e.g.,
mCtx.getString().

Am I correct that this is the only way to do this? Also, if I want to
use any other Android class that requires a context (e.g.
AlertDialog.Builder), I essentially have to "pass" the context from
the main Activity object to any class that needs to use it?

I guess my main question is whether there's another way to get the
Context without having to pass it from class to class as an argument.

-- 

3. Toggle Button state programatically

4. "Share" library

5. TabIndicator's tab_selected/tab_unselected drawables are white in v1.6 and grey in v2.x

6. Any Interview Question

7. How to distribute expensive Android app