Can a local notification only vibrate the apple wa

2019-07-13 17:12发布

I'd like to schedule a local notification on the phone. When the phone is locked and the watch is sleep I'd like the notification to vibrate the watch but not play a sound. Is this possible? My code below runs on the iphone to schedule the notification but don't know how to suppress the sound when playing on the watch.

UILocalNotification *notification = [[UILocalNotification alloc] init];
        notification.fireDate = [[NSDate date] dateByAddingTimeInterval:60];
        notification.alertTitle = [NSString stringWithFormat:@"Hi # %d", i];
        notification.alertBody = @"Hello!";
        notification.soundName = UILocalNotificationDefaultSoundName;

        [[UIApplication sharedApplication] scheduleLocalNotification:notification];

1条回答
叛逆
2楼-- · 2019-07-13 17:58

You can decide to not set the sound name and not opt in to use sounds in your notification settings. You can then make your own vibration behavior if there is not already one.

查看更多
登录 后发表回答