Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone push notifications information

Is it possible to transfer any information in the push notification beside "badge" "sound" and "text"?

For example, in the app "whatsapp" when a push notification appears and pressed, the app is opened but not going to the conversation. My guess is that it can't know what conversation to go to. But then I saw that in facebook messenger app it actually goes in the conversation. how does the messenger app know that what conversation to go to?

Also, if it is possible to transfer information, why is it that apps like whatsapp don't use it and also ask you for your name so it will be displayed in the push?

like image 237
roiberg Avatar asked Dec 21 '22 14:12

roiberg


1 Answers

Yes, indeed. But your message size (in bytes) must not pass a certain threshold Apple has imposed. You can then pull that info in the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions using something like this:

NSDictionary* dictionary = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];

Where dictionary contains your push notification info.

like image 200
Cyupa Avatar answered Feb 07 '23 01:02

Cyupa