#23 Notifications while app is suspended

This commit is contained in:
EddyVerbruggen
2015-01-13 13:48:17 +01:00
parent 2fdfde7a1a
commit 23e5029f89
3 changed files with 29 additions and 7 deletions
+13 -1
View File
@@ -13,11 +13,15 @@ import org.json.JSONException;
public void onTick(long millisUntilFinished) {toast.show();}
public void onFinish() {toast.show();}
}.start();
Also, check https://github.com/JohnPersano/SuperToasts
*/
public class Toast extends CordovaPlugin {
private static final String ACTION_SHOW_EVENT = "show";
private android.widget.Toast mostRecentToast;
@Override
public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
if (ACTION_SHOW_EVENT.equals(action)) {
@@ -51,6 +55,7 @@ public class Toast extends CordovaPlugin {
}
toast.show();
mostRecentToast = toast;
callbackContext.success();
}
});
@@ -61,4 +66,11 @@ public class Toast extends CordovaPlugin {
return false;
}
}
}
@Override
public void onPause(boolean multitasking) {
if (mostRecentToast != null) {
mostRecentToast.cancel();
}
}
}