• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Background-Task (Timer)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Background-Task (Timer)
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: I want a window's file owner that's not a NSWindowController
  • Next by Date: Re: Acquiring an NSConnection otherwise than by registered name?
  • Previous by thread: Re: My NSSwappedDouble decoding crashes on iPhone 4
  • Next by thread: Re: Background-Task (Timer)
  • Index(es):
    • Date
    • Thread