Skip to content

Commit f34dfc8

Browse files
author
Borja Antona
committed
- Added lock method to return the device to the state before executing unlock
1 parent 0a6bf35 commit f34dfc8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/android/BackgroundModeExt.java

+3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ public boolean execute (String action, JSONArray args,
115115
wakeup();
116116
unlock();
117117
break;
118+
case "lock":
119+
clearScreenAndKeyguardFlags();
120+
break;
118121
default:
119122
validAction = false;
120123
}

www/background-mode.js

+13
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,19 @@ exports.unlock = function()
291291
}
292292
};
293293

294+
/**
295+
* Returns the device to the state before executing unlock.
296+
*
297+
* @return [ Void ]
298+
*/
299+
exports.lock = function()
300+
{
301+
if (this._isAndroid)
302+
{
303+
cordova.exec(null, null, 'BackgroundModeExt', 'lock', []);
304+
}
305+
};
306+
294307
/**
295308
* If the mode is enabled or disabled.
296309
*

0 commit comments

Comments
 (0)