Cordova push and local conflict

I created a mobile app (Ionic + Cordova). Installed Cordova Push Notifications , Cordona Local Notification Module But when I receive a push notification or from the screen, I lose all my local notifications. And if I check them with the isScheduled function, I get TRUE. If I remove the push message code

var config = null;
        if (ionic.Platform.isAndroid()) {
            config = {
                "senderID": "111111111111" // REPLACE THIS WITH YOURS FROM GCM CONSOLE - also in the project URL like: https://console.developers.google.com/project/434205989073
                //"ecb": "window.onNotificationGCM"
            }
        } else if (ionic.Platform.isIOS()) {
            config = {
                "badge": "true",
                "sound": "true",
                "alert": "true"
            }
        }

        $cordovaPush.register(config).then(function(result) {
            // ** NOTE: Android regid result comes back in the pushNotificationReceived, only iOS returned here
            if (ionic.Platform.isIOS()) {
                $rootScope.regId = result;
                scheduleNotifications.storeDeviceToken("ios");
            }
        }, function(err) {
            navigator.notification.alert("Register error " + err);
        });

      

it works fine. What could be wrong with this?

+3


source to share


2 answers


This solution is just add "clearNotifications": false for push init



var push = PushNotification.init({
        "android": {
        "senderID": "114273210157",
        "clearNotifications": false
       },
       "ios": {"alert": "true", "badge": "true", "sound": "true"}
      });

      

+1


source


I think you have it good because I can't even run them together.

    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Landroid/support
    /v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfo
    VersionImpl;

      



Local notification installs android.support.v4 as a dependency which conflicts with the rest of Ionic.

EDIT: Fixed by nuking the v4.jar file under platforms / android / libs.

+2


source







All Articles