PAn Kaj Khatri
PAn Kaj Khatri

Reputation: 539

UILocalNotification Sound and vibration setting IOS

I am scheduling the local notification with custom sound. But what i need is to set the volume level and vibrate the phone along with notification. is it possible?

Upvotes: 1

Views: 662

Answers (1)

Ken Cheung
Ken Cheung

Reputation: 1808

Around three years ago I use the following code to push up the volume when the app receives a trigger from my BLE tag. But I don't know if you can get this done with a local notification or not.

- (void) maxDeviceVolume:(float) vol
{
    UISlider *volumeSlider;
    MPVolumeView *myVolumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
    for (UIView *view in [myVolumeView subviews]) {
        if ([[[view class] description] isEqualToString:@"MPVolumeSlider"]) {
            volumeSlider = (UISlider *)view;
        }
    }
    [volumeSlider setValue:vol animated:NO];
}

Upvotes: 1

Related Questions