Loading src/android/com/plugin/gcm/GCMIntentService.java +2 −2 Changes for src/android/com/plugin/gcm/GCMIntentService.java: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -69,8 +69,8 @@ public class GCMIntentService extends GCMBaseIntentService { { PushPlugin.sendExtras(extras); // Send a notification if there is a message if (extras.getString("message").length() != 0) { // Send a notification if there is a message and not in foreground if (!PushPlugin.isInForeground() && extras.getString("message").length() != 0) { createNotification(context, extras); } } Loading src/android/com/plugin/gcm/PushPlugin.java +19 −0 Changes for src/android/com/plugin/gcm/PushPlugin.java: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ public class PushPlugin extends CordovaPlugin { private static String gECB; private static String gSenderID; private static Bundle gCachedExtras = null; private static boolean gForeground = true; /** * Gets the application context from cordova's main activity. Loading Loading @@ -108,6 +109,7 @@ public class PushPlugin extends CordovaPlugin { public static void sendExtras(Bundle extras) { if (extras != null) { extras.putBoolean("foreground", gForeground); if (gECB != null && gWebView != null) { sendJavascript(convertBundleToJson(extras)); } else { Loading @@ -117,6 +119,18 @@ public class PushPlugin extends CordovaPlugin { } } @Override public void onPause(boolean multitasking) { super.onPause(multitasking); gForeground = false; } @Override public void onResume(boolean multitasking) { super.onResume(multitasking); gForeground = true; } /* * serializes a bundle to JSON. */ Loading Loading @@ -201,6 +215,11 @@ public class PushPlugin extends CordovaPlugin { return null; } public static boolean isInForeground() { return gForeground; } public static boolean isActive() { return gWebView != null; Loading Loading
src/android/com/plugin/gcm/GCMIntentService.java +2 −2 Changes for src/android/com/plugin/gcm/GCMIntentService.java: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -69,8 +69,8 @@ public class GCMIntentService extends GCMBaseIntentService { { PushPlugin.sendExtras(extras); // Send a notification if there is a message if (extras.getString("message").length() != 0) { // Send a notification if there is a message and not in foreground if (!PushPlugin.isInForeground() && extras.getString("message").length() != 0) { createNotification(context, extras); } } Loading
src/android/com/plugin/gcm/PushPlugin.java +19 −0 Changes for src/android/com/plugin/gcm/PushPlugin.java: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ public class PushPlugin extends CordovaPlugin { private static String gECB; private static String gSenderID; private static Bundle gCachedExtras = null; private static boolean gForeground = true; /** * Gets the application context from cordova's main activity. Loading Loading @@ -108,6 +109,7 @@ public class PushPlugin extends CordovaPlugin { public static void sendExtras(Bundle extras) { if (extras != null) { extras.putBoolean("foreground", gForeground); if (gECB != null && gWebView != null) { sendJavascript(convertBundleToJson(extras)); } else { Loading @@ -117,6 +119,18 @@ public class PushPlugin extends CordovaPlugin { } } @Override public void onPause(boolean multitasking) { super.onPause(multitasking); gForeground = false; } @Override public void onResume(boolean multitasking) { super.onResume(multitasking); gForeground = true; } /* * serializes a bundle to JSON. */ Loading Loading @@ -201,6 +215,11 @@ public class PushPlugin extends CordovaPlugin { return null; } public static boolean isInForeground() { return gForeground; } public static boolean isActive() { return gWebView != null; Loading