Do you get this power when you run the code in the emulator on the device itself?
Have you set breakpoints in eclipse to make sure the call to getSystemService () is causing the problem?
In an eclipse, when a power circuit occurs, does LogCat talk about this?
You set
<uses-permission android:name="android.permission.WAKE_LOCK" />
in the manifest?
You can also try defining pm as final:
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
Let me know if this helps ...
source
share