Background notification in phone stutter

I am creating a simple alarm clock with Phonegap for ios, and I have notifications running in the background and foreground. (All with the help of Drew Dalman and this tutorial http://www.drewdahlman.com/meusLabs/?p=84 ).

The phonegap plugin provides the ability to run background and front functions when localNotification is triggered.

My problem is that if the application is in the background, I seem to get only the close / view dialog by default, and not the notification dialog that I install. I was hoping that the background notification would give the user the ability to "stand up" or "put off", but of course this is not possible with the close / view notification by default.

Am I really wrong? Is there another way?

My code for setting up local notification is simple

 plugins.localNotification.add ({date: set_alarm, message: "background", badge: 1, id: 12, sound: 'Alarm_01.caf', background: 'MyApp.Alarm.notification_background', foreground: 'MyApp.Alarm. notification_foreground '}); 

The notifications in the foreground are working fine, it's just a help notification I'm struggling with.

+4
source share
1 answer

In the delegate.m application file, you need to activate an alarm or local notification when the application has entered the background mode:

- (void)applicationDidEnterBackground:(UIApplication *)application 

or

 - (void)applicationWillResignActive:(UIApplication *)application 

(depending on your needs) Additional documentation can be found here:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html

My suspicion is that you configured the application only to disable the alarm after –application:didFinishLaunchingWithOptions: and -application:didReceiveLocalNotification:

which is the default.

There are many other options:

Monitoring application state changes

  • Applications: willFinishLaunchingWithOptions:
  • Applications: didFinishLaunchingWithOptions:
  • applicationDidBecomeActive:
  • applicationWillResignActive:
  • applicationDidEnterBackground:
  • applicationWillEnterForeground:
  • applicationWillTerminate:
  • applicationDidFinishLaunching:

Managing Application Recovery

  • Application: shouldSaveApplicationState:
  • Application: shouldRestoreApplicationState:
  • Application: viewControllerWithRestorationIdentifierPath: encoder:
  • Application: willEncodeRestorableStateWithCoder:
  • Application: didDecodeRestorableStateWithCoder:

Providing a window for the storyboard window property Controls the default orientation of the interface

  • Application: supportedInterfaceOrientationsForWindow:

URL Resource Open

  • Application: OpenUrl: sourceApplication: annotation:
  • Application: handleOpenURL:

Status Bar Change Management

  • Application: willChangeStatusBarOrientation: Duration:
  • Application: didChangeStatusBarOrientation:
  • Application: willChangeStatusBarFrame:
  • Application: didChangeStatusBarFrame:

Reply to system notifications

  • applicationDidReceiveMemoryWarning:
  • applicationSignificantTimeChange:

Remote Notification Handling

  • Application: didReceiveRemoteNotification:
  • Application: didRegisterForRemoteNotificationsWithDeviceToken:
  • Application: didFailToRegisterForRemoteNotificationsWithError:

Respond to content protection changes

  • applicationProtectedDataWillBecomeUnavailable:
  • applicationProtectedDataDidBecomeAvailable:
0
source

All Articles