Background-Task (Timer)
Background-Task (Timer)
- Subject: Background-Task (Timer)
- From: Lukas Tenbrink <email@hidden>
- Date: Wed, 29 Sep 2010 10:54:31 +0200
Hey there, Cocoa List!
I've got a question about background tasking, and I couldn't really answer myself it by searching in the documentation (or even in the internet).
I want to make a background task with an application. Firstly, I used the code they gave as a sample, which looks like this:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication* app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:
^{
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self showALocalNotification];
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
});
}
It actually shows my local notification, but I want the application to check for some conditions (like "Is the Device charging?" or "In what way does the user hold the device?"), and if certain conditions are complied with, I want to show the local notification. So I only want that the Device sends me a message from time to time (like every 10 seconds), then I execute a little bit of code, and maybe show this notification.
Does somebody know if this is possible? Thanks in before,
Lukas_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden