I am developing an app based on sip calling and I want to send call in background if any one starts call and comes out of application .In that case I want to display call duration on screen .For that that I am using in_call status bar.But the code I have used is setting background color of in_call status bar to red and I am not getting how to change its color to green also want to show timer on it .As I am using this first time I am not getting how to solve this .Here is my code .Please help if any one can . I am calling this method on didFinishLaunchingWithOptions method
+(void) startRecording {
AVAudioSession * audioSession = [AVAudioSession sharedInstance];
NSError * err = nil;
[audioSession setCategory: AVAudioSessionCategoryPlayAndRecord error: & err];
if (err) {
NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [
[err userInfo] description
]);
return;
}
[audioSession setActive: YES error: & err];
err = nil;
if (err) {
NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [
[err userInfo] description
]);
return;
}
NSMutableDictionary * recordSetting = [
[NSMutableDictionary alloc] init
];
[recordSetting setValue: [NSNumber numberWithInt: kAudioFormatLinearPCM] forKey: AVFormatIDKey];
[recordSetting setValue: [NSNumber numberWithFloat: 44100.0] forKey: AVSampleRateKey];
[recordSetting setValue: [NSNumber numberWithInt: 2] forKey: AVNumberOfChannelsKey];
[recordSetting setValue: [NSNumber numberWithInt: 16] forKey: AVLinearPCMBitDepthKey];
[recordSetting setValue: [NSNumber numberWithBool: NO] forKey: AVLinearPCMIsBigEndianKey];
[recordSetting setValue: [NSNumber numberWithBool: NO] forKey: AVLinearPCMIsFloatKey];
NSURL * url = [NSURL fileURLWithPath: @"/dev/null"];
err = nil;
AVAudioRecorder * recorder = [
[AVAudioRecorder alloc] initWithURL: url settings: recordSetting error: & err
];
if (!recorder) {
NSLog(@"recorder: %@ %d %@", [err domain], [err code], [
[err userInfo] description
]);
UIAlertView * alert = [
[UIAlertView alloc] initWithTitle: @"Warning"
message: [err localizedDescription]
delegate: nil
cancelButtonTitle: @"OK"
otherButtonTitles: nil
];
[alert show];
return;
}
//prepare to record
[recorder setDelegate: self];
[recorder prepareToRecord];
recorder.meteringEnabled = YES;
BOOL audioHWAvailable = audioSession.inputIsAvailable;
if (!audioHWAvailable) {
UIAlertView * cantRecordAlert = [
[UIAlertView alloc] initWithTitle: @"Warning"
message: @"Audio input hardware not available"
delegate: nil
cancelButtonTitle: @"OK"
otherButtonTitles: nil
];
[cantRecordAlert show];
return;
}
// start recording
[recorder record]; //recordForDuration:(NSTimeInterval) 40];
}