안녕하세요. 호출 중에 가속도계를 호출해야합니다.이 코드를 호출하는 동안이 코드를 사용합니다.통화가 활성화되어있을 때 가속도계를 실행할 가능성이 있습니까?
- (void)applicationDidEnterBackground:(UIApplication *)application
{
if(isSlamOff == FALSE){
NSLog(@"Slame is off");
if(callState == CTCallStateConnected) {
UIAccelerometer *accelerometer =[UIAccelerometer sharedAccelerometer];
accelerometer.updateInterval = 0.1;
accelerometer.delegate = self;
}
}
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration{
UIAccelerationValue x, y, z;
x = acceleration.x;
y = acceleration.y;
z = acceleration.z;
NSLog(@"x is %4.2f, y is %4.2f and z is %4.2f",x,y,z);
magnitude = sqrt(acceleration.x * acceleration.x
+ acceleration.y * acceleration.y
+ acceleration.z * acceleration.z);
NSLog(@"%f",magnitude);
if(magnitude > 2.5){
NSString *soundFilePath = [[NSBundle mainBundle] pathForResource:@"slamshort" ofType:@"wav"];
NSURL *newURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:newURL error: nil];
[newPlayer prepareToPlay];
NSLog(@"Music Is Playing");
AudioSessionSetProperty(kAudioSessionOverrideAudioRoute_Speaker, sizeof(newPlayer),&newPlayer);
[newPlayer setVolume: 1.0];
[newPlayer play];
}
}
그러나 어느 쪽도없는 통화 상태를 표시하거나 통화 중 배경에 가속도를 실행하고 나는 애플 아이폰 OS의 최신 멀티 태스킹 기능 가이드에서이 사용되지만에서 실행되지 전화와 가속도계의 상태를 표시하지 배경. 통화 중에 가속을 감지하고 통화 중에 오디오 파일을 재생할 수 있습니까, 아니면 iOS에서는 불가능합니다. 아니면 가능한 경우 가능한 방법이나 코드가 무엇입니까.
IMHO는 전화 도중에 오디오 파일을 재생할 생각을하는 사용자 나 Apple 검토 팀이 아닙니다. – Saran