Commit f0b66123 authored by Erik Jan de Wit's avatar Erik Jan de Wit
Browse files

do not add notification if application in foreground

parent a5aa12d0
Loading
Loading
Loading
Loading
+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
@@ -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);
			}
		}
+5 −0
Changes for src/android/com/plugin/gcm/PushPlugin.java: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -215,6 +215,11 @@ public class PushPlugin extends CordovaPlugin {
		return null;      	
    }

    public static boolean isInForeground()
    {
      return gForeground;
    }

    public static boolean isActive()
    {
    	return gWebView != null;