Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  1. Open your Xcode project, which was generated by the PhoneGap build:
    Image Removed
    Image Added
  2. Go to your AppDelegate.m file and add this import at the top of the file:

     

    1
    #import "PushApps.h"
  3. Still in the AppDelegate.m file, add those line before the @end word:

     

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    #pragma mark - Push Notifications
    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
    {
        // Notify PushApps of a successful registration.
        [[PushAppsManager sharedInstance] updatePushToken:deviceToken];
    }
     
    // Gets called when a remote notification is received while app is in the foreground.
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    {
        [[PushAppsManager sharedInstance] handlePushMessageOnForeground:userInfo];
    }
  4. That's it! Now take a look on our PhoneGap API. You'll find there how to register a device, unregister and handle received notifications.