views:

36

answers:

1

Hello,

If my application is started and only started. I implemented application:didReceiveRemoteNotification: to receive the payload. If a message is sent to my iPhone, is this method called for every registration type, such as the following one?

  1. [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeNone];
  2. [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge];
  3. [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeSound];
  4. [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];

I have a big doubt for solution 1...

A: 

The method only needs to be called once. The types argument is a bitmask of the types that you wish to register for:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];

The code above would register for Badge and Sound remote notifications.

Adam Douglass
Thx Adam, but that's not the answer to my question.I'd like to know if it is possible to receive push when the application is launched without getting any notification when the app is not launched.
Eric V
Ahh -- you could try sending a push notification without a badge, alert or sound (only custom data). Push notifications were designed for situations when your app is NOT running.
Adam Douglass
What do you mean? I can send data with only custom data without a badge, alert or sound ?
Eric V