slaveCoder
slaveCoder

Reputation: 537

Make the ios app working in background

I'm using the pitch detection code from demetri miller demetri miller pitch detection in my application. I want the microphone to work in background and give a UILocalNotification on a particular pitch.

How to make the application run in background. Currently when the app is in background is there way to make it work fully.

Upvotes: 0

Views: 93

Answers (1)

Romance
Romance

Reputation: 1414

Use the NSTimer when app is going from foreground to background start NSTimer and every one second your timer method will call and you can check the application state. you can execute every thing fine.

   NSTimer *timerBackground = [NSTimer timerWithTimeInterval:1.0
                                 target:self
                               selector:@selector(YourMethod:)
                               userInfo:nil
                                repeats:YES];

        [[NSRunLoop currentRunLoop] addTimer:timerBackground forMode:NSDefaultRunLoopMode];

Upvotes: 1

Related Questions