问题描述:

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?

网友答案:

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];
}
相关阅读:
Top