Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19449] iOS schedule local notification doesn't make the default sound or phone vibration

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionWon't Fix
Resolution Date2015-09-01T22:46:05.000+0000
Affected Version/sRelease 3.5.1, Release 4.0.0, Release 4.1.0
Fix Version/sn/a
ComponentsiOS
Labelsios8, notification
Reporter Ricardo Ramirez
AssigneeHans Knöchel
Created2015-09-01T20:27:38.000+0000
Updated2015-09-01T22:46:05.000+0000

Description

Issue Description

When the type Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND is defined and the sound property is not defined in the scheduleLocalNotification function, the device is not making the default sound and the device vibration on the alert.

Expected behavior

The device should make the sound alert and vibrate.

Steps to Replicate:

1. Create a new titanium classic project 2. Grab the app.js file 3. Replace the code with the testcase code 4. Run the application on iOS device

Test Case

// Check if the device is running iOS 8 or later, before registering for local notifications
if (Ti.Platform.name == "iPhone OS" && parseInt(Ti.Platform.version.split(".")[0]) >= 8) {
    Ti.App.iOS.registerUserNotificationSettings({
	    types: [
            Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT,
            Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,
            Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE
        ]
    });
}



var notification = Ti.App.iOS.scheduleLocalNotification({
    alertAction: "update",
    alertBody: "New content available! Update now?",
    badge: 1,
    date: new Date(new Date().getTime() + 6000),
    //sound: "/ahem_x.wav",
}); 

var mainWindow = Ti.UI.createWindow();

var mainView = Ti.UI.createView({backgroundColor:"white"});

var desclabel = Ti.UI.createLabel({text:"Press the home or lock button and wait for the alert "});

mainWindow.add(mainView);
mainView.add(desclabel);
mainWindow.open();

Comments

  1. Hans Knöchel 2015-09-01

    [~rramirez] Have you tried to set the sound property to "default"? Please try if not! EDIT: This is what we're doing under the hood:
       if ([sound isEqual:@"default"]) {
         localNotif.soundName = UILocalNotificationDefaultSoundName;
       }
       
    So providing "default" as the value of the "sound"-property should fix the issue.
  2. Hans Knöchel 2015-09-01

    Closing this issue, since [~rramirez] have been able to fix the issue by setting the sound property to "default".

JSON Source