|
|
@ -116,11 +116,16 @@ public class PowerManagement extends CordovaPlugin {
|
|
|
|
PluginResult result = null;
|
|
|
|
PluginResult result = null;
|
|
|
|
|
|
|
|
|
|
|
|
if( this.wakeLock != null ) {
|
|
|
|
if( this.wakeLock != null ) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
this.wakeLock.release();
|
|
|
|
this.wakeLock.release();
|
|
|
|
this.wakeLock = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = new PluginResult(PluginResult.Status.OK, "OK");
|
|
|
|
result = new PluginResult(PluginResult.Status.OK, "OK");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
|
|
|
result = new PluginResult(PluginResult.Status.ILLEGAL_ACCESS_EXCEPTION, "WakeLock already released");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.wakeLock = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
result = new PluginResult(PluginResult.Status.ILLEGAL_ACCESS_EXCEPTION, "No WakeLock active - acquire first");
|
|
|
|
result = new PluginResult(PluginResult.Status.ILLEGAL_ACCESS_EXCEPTION, "No WakeLock active - acquire first");
|
|
|
|
}
|
|
|
|
}
|
|
|
|