forked from Github/cordova-plugin-run-in-background
New method isActive to receive if mode is active
This commit is contained in:
@@ -290,12 +290,18 @@ public class BackgroundMode extends CordovaPlugin {
|
||||
eventName = "deactivate"; break;
|
||||
default:
|
||||
eventName = "failure";
|
||||
|
||||
}
|
||||
|
||||
final String js = String.format("setTimeout('%s.on%s(%s)',0)",
|
||||
String active = event == Event.ACTIVATE ? "true" : false;
|
||||
|
||||
String flag = String.format("%s._isActive=%s;",
|
||||
JS_NAMESPACE, active);
|
||||
|
||||
String fn = String.format("setTimeout('%s.on%s(%s)',0);",
|
||||
JS_NAMESPACE, eventName, params);
|
||||
|
||||
final String js = flag + fn;
|
||||
|
||||
cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user