fix
This commit is contained in:
parent
dd5b6d7dcc
commit
71695ca851
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.idea
|
10
package.json
10
package.json
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "cordova-plugin-powermanagement-orig",
|
||||
"name": "cordova-plugin-powermanagement2",
|
||||
"version": "1.1.0",
|
||||
"description": "Plugin for managing the power state (i.e. idle switching) for cordova",
|
||||
"scripts": {
|
||||
@ -7,14 +7,14 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/boltex/cordova-plugin-powermanagement.git"
|
||||
"url": "git+https://github.com/sitronik/cordova-plugin-powermanagement2.git"
|
||||
},
|
||||
"author": "Viras-",
|
||||
"author": "Sitronik",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/boltex/cordova-plugin-powermanagement/issues"
|
||||
"url": "https://github.com/sitronik/cordova-plugin-powermanagement2/issues"
|
||||
},
|
||||
"homepage": "https://github.com/boltex/cordova-plugin-powermanagement#readme",
|
||||
"homepage": "https://github.com/sitronik/cordova-plugin-powermanagement2#readme",
|
||||
"keywords": [
|
||||
"ecosystem:cordova",
|
||||
"cordova-android",
|
||||
|
@ -58,7 +58,7 @@ public class PowerManagement extends CordovaPlugin {
|
||||
public void run() {
|
||||
try {
|
||||
//Log.d("PowerManagementPlugin", "About to declare ourselves VISIBLE");
|
||||
webView.getEngine().getView().dispatchWindowVisibilityChanged(View.VISIBLE);
|
||||
webView.getView().dispatchWindowVisibilityChanged(View.VISIBLE);
|
||||
|
||||
// if sdk is 23 (android 6) or greater
|
||||
if(android.os.Build.VERSION.SDK_INT > 22){
|
||||
@ -104,6 +104,13 @@ public class PowerManagement extends CordovaPlugin {
|
||||
|
||||
}
|
||||
|
||||
public PluginResult partialWakeLock() {
|
||||
Log.d("PowerManagementPlugin", "Partial wake lock" );
|
||||
PluginResult result = this.acquire( PowerManager.PARTIAL_WAKE_LOCK );
|
||||
handler.postDelayed(heartbeat, 10000);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(String action, JSONArray args,
|
||||
CallbackContext callbackContext) throws JSONException {
|
||||
@ -115,12 +122,9 @@ public class PowerManagement extends CordovaPlugin {
|
||||
try {
|
||||
if( action.equals("acquire") ) {
|
||||
if( args.length() > 0 && args.getBoolean(0) ) {
|
||||
Log.d("PowerManagementPlugin", "Partial wake lock" );
|
||||
result = this.acquire( PowerManager.PARTIAL_WAKE_LOCK );
|
||||
handler.postDelayed(heartbeat, 10000);
|
||||
}
|
||||
else {
|
||||
result = this.acquire( PowerManager.FULL_WAKE_LOCK );
|
||||
result = partialWakeLock();
|
||||
} else {
|
||||
result = partialWakeLock();
|
||||
}
|
||||
} else if( action.equals("release") ) {
|
||||
result = this.release();
|
||||
|
Loading…
x
Reference in New Issue
Block a user