This is a migrated thread and some comments may be shown as answers.

Everlive Pushnotification sound

3 Answers 84 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Douw3rd
Top achievements
Rank 1
Douw3rd asked on 02 Sep 2013, 09:05 PM
I was trying to change the sounds used by the everlive push notification template on receiving a pushnotification, but have been unsuccessful so far.

I mainly tried messing around with the main.js code:

var pushSettings = {
                android: {
                    senderID: androidProjectNumber
                },
                iOS: {
                    badge: "true",
                    sound: "true",
                    alert: "true"
                },
                notificationCallbackAndroid : onAndroidPushReceived,
                notificationCallbackIOS: onIosPushReceived
            }

Any one who can push me in the right direction?

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 03 Sep 2013, 04:10 PM
Hello Douwe,

The sound boolean property specifies whether the device will play a notification sound or not. To specify a specific sound file, you should use the IOS.aps.sound property, see Everlive documentation.

Regards,
Steve
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Douw3rd
Top achievements
Rank 1
answered on 07 Sep 2013, 11:08 AM
Hey Steve,

thanks for your answer! 

Reading the Everlive documentation you linked gives me the impression that everlive only support sounds options for IOS, not Android. Is this correct?

Kind Regards,

Douwe

0
Ivan Pelovski
Telerik team
answered on 13 Sep 2013, 03:31 PM
Hello Douwe,

Playing a sound in iOS when receiving a notification is supported by the OS itself. You may specify the name of the media file and the OS will play it. This is not the case for Android. It does not support such feature out of the box, and you should play a sound programmatically when you receive a push notification. You can check the sample of the PushPlugin of Cordova:
// Android
function onNotificationGCM(e) {
 
    switch( e.event ) {
        // ...
        case 'message':
            // if this flag is set, this notification happened while we were in the foreground.
            // you might want to play a sound to get the user's attention, throw up a dialog, etc.
            if (e.foreground)
            {
                $("#app-status-ul").append('<li>--INLINE NOTIFICATION--' + '</li>');
 
                // if the notification contains a soundname, play it.
                var my_media = new Media("/android_asset/www/"+e.soundname);
                my_media.play();
            }
            else
            {   // otherwise we were launched because the user touched a notification in the notification tray.
                if (e.coldstart)
                    $("#app-status-ul").append('<li>--COLDSTART NOTIFICATION--' + '</li>');
                else
                $("#app-status-ul").append('<li>--BACKGROUND NOTIFICATION--' + '</li>');
            }
        // ...
    }
}


Regards,
Ivan Pelovski
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
Tags
General Discussion
Asked by
Douw3rd
Top achievements
Rank 1
Answers by
Steve
Telerik team
Douw3rd
Top achievements
Rank 1
Ivan Pelovski
Telerik team
Share this question
or