Compare commits
2 Commits
kerr/add-e
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
361358a458 | ||
|
df990e762f |
@ -101,9 +101,6 @@ public class BackgroundModeExt extends CordovaPlugin {
|
|||||||
case "webview":
|
case "webview":
|
||||||
disableWebViewOptimizations();
|
disableWebViewOptimizations();
|
||||||
break;
|
break;
|
||||||
case "enableWebview":
|
|
||||||
enableWebViewOptimizations();
|
|
||||||
break;
|
|
||||||
case "appstart":
|
case "appstart":
|
||||||
openAppStart(args.opt(0));
|
openAppStart(args.opt(0));
|
||||||
break;
|
break;
|
||||||
@ -199,31 +196,6 @@ public class BackgroundModeExt extends CordovaPlugin {
|
|||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableWebViewOptimizations() {
|
|
||||||
Thread thread = new Thread(){
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
getApp().runOnUiThread(() -> {
|
|
||||||
View view = webView.getView();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Class.forName("org.crosswalk.engine.XWalkCordovaView")
|
|
||||||
.getMethod("onHide")
|
|
||||||
.invoke(view);
|
|
||||||
} catch (Exception e){
|
|
||||||
view.dispatchWindowVisibilityChanged(View.GONE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
thread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables battery optimizations for the app.
|
* Disables battery optimizations for the app.
|
||||||
* Requires permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS to function.
|
* Requires permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS to function.
|
||||||
|
@ -164,14 +164,6 @@ exports.disableWebViewOptimizations = function()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.enableWebViewOptimizations = function()
|
|
||||||
{
|
|
||||||
if (this._isAndroid)
|
|
||||||
{
|
|
||||||
cordova.exec(null, null, 'BackgroundModeExt', 'enableWebview', []);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables battery optimazation mode for the app.
|
* Disables battery optimazation mode for the app.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user