Push notifications on iphone


#1

Hi,

Has anyone implemented push notifications with cocos2d-x on iPhone?

Thanks

Jesus


#2

I think you need a wrapper, again.


#3

yes, but probably someone did it in the past… and it would be nice to share the code with others… just as I do…


#4

I’ve added this code at the didFinishLaunchingWithOptions method in the AppController.mm

// Let the device know we want to receive push notifications
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:
(UIRemoteNotificationType)(UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound)];

, but I never see the promt window asking permission to use push notifications, so this code never fires:

  • (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
    {
    NSLog("My token is: %", deviceToken);
    }

#5

ok, now it works, solution here:


#6

Is there some code available somewhere for this ?


#7

Hey, You can go through with ShepHertz Push Notification API, provides various API’s for Push Notification across multiple platform.
Here you can find Sample Application. You can build Android as well as iOS app to use Push Notification in your App.