Custom sound repeated multiple times on Android #237

Closed
matteoferigo opened this Issue Oct 19, 2015 · 4 comments

Projects

None yet

3 participants

@matteoferigo

Hi, I'm using a wav file placed on res/raw to notify a new push notification.
The sound (stored in the www folder) is working on iOS correctly, but on Android the sound and the vibration is fired multiple times.

Cordova version: 5.3.3

Android platform: 4.1.1
id: 1 or "android-22"
Name: Android 5.1.1
Type: Platform
API level: 22
Revision: 2
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a, default/x86, default/x86_64
id: 2 or "Google Inc.:Google APIs:22"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 5.1.1 (API level 22)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64

Plugins:
com.paypal.cordova.mobilesdk 3.1.12 "PayPalMobile"
com.phonegap.plugins.facebookconnect 0.11.0 "Facebook Connect"
cordova-plugin-actionsheet 2.0.1 "ActionSheet"
cordova-plugin-console 1.0.1 "Console"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-geolocation 1.0.1 "Geolocation"
cordova-plugin-media 1.0.1 "Media"
cordova-plugin-splashscreen 2.1.0 "Splashscreen"
cordova-plugin-webserver 1.0.3 "CordovaWebServer"
cordova-plugin-whitelist 1.0.0 "Whitelist"
ionic-plugin-keyboard 1.0.7 "Keyboard"
phonegap-plugin-push 1.3.0 "PushPlugin"

@macdonst
Member

@noldotar do you have more than on app on your device registered with the same Push Project from Google? Other than that can you send me an example payload.

@matteoferigo

I don't know which kind of payload I can send to you, but I can show you how I use the push-plugin on my app. This is the code running every time the app is launched:

document.addEventListener("deviceready", function() {
    // Push Notification
    var push = PushNotification.init({
        android: {
            senderID: "************",
            sound: true,
            vibrate: true,
        },
        ios: {
            sound: true,
            badge: true,
            alert: true
        },
        windows: {},
    });

    push.on('registration', function(data) {
        devicePushId = data.registrationId
    });


    push.on('notification', function(data) {
            console.info('New Push Notification');
        console.debug(data);

        // I add missing additionalData
        if (data.additionalData) {
            data.additionalData.title = data.title;
            data.additionalData.message = data.message;
        }

        // redirect to landing page
        if (data.additionalData.ad)
            document.location.href = '#/push/' + JSON.stringify(data.additionalData);
        else if (data.additionalData.order)
            document.location.href = '#/order/' + JSON.stringify(data.additionalData.order);
    });


    console.info('Plugins loaded');
}, false);

I have more than one account register with that device, do you mean that if more than one user is registered with that device... Google is sending as many messages as many as registered customers and not one message for each pushId sent?

20/10/2015 09:39:01 - New Push to 6 users
            Customers IDs: *****-t1DIy_V6WyGKxsSHsN0NSOSc-nuUJP5m, *****-1bY2KVbfLQBA0W2oI31TgHUlYeoy1yRhC4ahNTQnhG25rjWgc_kIC98Mvn9lXoW, *****-LQje3Bop4Cxtd36MO-nDvj_nm1r-0uzZG3WquxowW45eFAeFW0D5TsicDy, APA91bG5rCYqAh-*****, APA91bGlaEugixnA3qdodM7szL6zc7cxPgIvnLiHuqXmH9q-*****, APA91bHGTygrrtVijl7QwklF_MdRHvVMDTzqFbbplrtxX3yoZ7_*****
            {"soundname":"sound","title":"Push test","message":"Text message"}
@fredgalvao
Contributor

That is definitely not the case, @noldotar . Only one copy of the payload is delivered to each matched registrationId, that's for sure.

@matteoferigo

Ok, I found the issue. My mistake on the payload: I was pushing all registration_ids for each single push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment