0

I am using Push Sharp to send push notification to iOS and Android clients. I need to send a List of strings, but not sure how can I achieve this? Do I need to send it with payload? Can someone show me code to do this?

For iOS sample code is given:

 var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, 
                 "../../../Resources/PushSharp.Apns.Sandbox.p12"));

 //Extension method
 push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "radint123?")); 

 push.QueueNotification(new AppleNotification()
     .ForDeviceToken("b06d5462020a01703f6c740f8de77d7450878739ec2954775db5411d0f3f17d7")
     .WithAlert("Hello World!").WithBadge(i)
     .WithSound(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, 
            "../../../Resources/sound.caf")));
Kay_N
  • 987
  • 5
  • 12
Hammad Nasir
  • 155
  • 3
  • 17

1 Answers1

0

Yes, you have to send it with payload like this (VB.Net Code):

Dim appleNotif As New AppleNotification
'Define other properties here

Dim notiPayLoad = New AppleNotificationPayload()
notiPayLoad.AddCustom("key1", "value1")
notiPayLoad.AddCustom("key2", "value2")
appleNotif.Payload = notiPayLoad
push.QueueNotification(appleNotif)
Ala' Alnajjar
  • 788
  • 1
  • 11
  • 23