0
假設用戶將iphone的響度設置爲5/10的值,我想將應用程序結果的音量從0%增加到100%,其中100%是5/10(設置的值由用戶)。我想讓這個動作緩慢增加,例如20秒。增加應用程序輸出的響度
如果我理解正確,應用程序不能超過用戶設置的最大音量輸出值。
不幸的是我找不到辦法做到這一點。我應該從哪裏開始完成這項任務?
我想發出警報。
現在我使用以下邏輯發送推送通知,即「喚醒」用戶。
- (void)sendLocalPushForAlarm {
if (IS_OS_8_OR_LATER) {
[self registerForLocalNotification];
}
UILocalNotification *notification = [[UILocalNotification alloc] init];
[notification setAlertBody:NSLocalizedString(@"WAKE_UP", nil)];
if (IS_OS_8_OR_LATER) {
[notification setCategory:NotificationCategoryIdent];
}
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
我使用多個聲音文件的多個通知:如果([AVAudioSession sharedInstance] .category!= AVAudioSessionCategoryPlayback){[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; [[AVAudioSession sharedInstance] setActive:YES error:nil]; [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; –
啊我覺得我沒有把握好。那麼當您再次進入應用程序後,您是否會在通知後播放聲音? –
是的,但我想從0%增加到100%,現在它從100%開始:) –