I want to use the method wakeUp of PowerManager. Eclipse (ADT) don't reconize this method. But there is no problem for the opposite "goToSleep" :
PowerManager pm = (PowerManager) MyApplication.getAppContext().getSystemService(Context.POWER_SERVICE);
pm.wakeUp(SystemClock.uptimeMillis()); //Detected as error by eclipse
pm.goToSleep(SystemClock.uptimeMillis()); //Not detected as error and work well
Eclipse error :
The method wakeUp(long) is undefined for the type PowerManager
Eclipse propose to me a quickfix, but i've the same error :
((Object) pm).wakeUp(SystemClock.uptimeMillis()); //the same error
Is this a bug or just me? Thanks !
First, as Luksprog pointed out, that method is new to API Level 17.
Also, it requires the DEVICE_POWER
permission, which can only be held by apps signed by the same signing key as was used to sign the firmware.