Discuss 2.1 and UIApplication daemons at the iPhone Developer Exchange - Hackint0sh.org; Hi there,
I'm working on a project where I have a Daemon running once a ...
2.1 and UIApplication daemons
I'm working on a project where I have a Daemon running once a minute, logging my position. All was well on firmware 2.0.2, but I believe Apple may have added a feature to wake up the screen if an app runs while the phone is sleeping (something to do with the push notification feature?).
My daemon depends on being a location-delegate, so I need to call the UIApplicationMain function to keep the app running, while the GPS does its work. But when I do this, the phone wakes up and beeps / vibrates.
Snipped version of my main.m:
int main(int argc, char *argv)
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Logger *logger = [[Logger alloc] initWithUser:[[NSUserDefaults standardUserDefaults] stringForKey:@"user"]];
retVal = UIApplicationMain(argc, argv, nil, nil); // This is where the phone wakes up and goes beep
Would anyone know how to keep an application more daemon'y so the phone doesn't think I'm trying to tell the user something?
Thanks in advance, and thanks for a great site/forum!
sounds similar to something i'm working on with the GPS stuff I'm not sure you need the UIApplicationMain do you? I'm guessing you're just using the CLLocationManager. Could you not just create a small app that you start from within your main app as a background process using fork/exec? I haven't got to that part of my app, but i've asked around on other forums and that's the direction i've been pointed.
If I don't call the UIApplicationMain, the location manager never returns any result. ..may be something runloop specific, I don't know :/
Thanks for the fork/exec angle - I'll try and play around with that, although I think this would just push the problem into the other background process instead. My app is a background process - and everything works just fine ..except it wakes up the screen everytime it runs (but only on OS 2.1).
strange. I haven't gone to 2.1 yet. Sounds like it's going to add more pain...
By tracstarr in forum iPhone Developer Exchange
Last Post: 02-01-2009, 07:12 PM