0

I've been using Redth/PushSharp code to implement server side push for both Android and iPhone.

Using the following code:

        foreach (Receipient in iOSUsers)
        {
            push.QueueNotification(NotificationFactory.Apple()
                .ForDeviceToken(APNS_Device_Token_Of_Receipient)
                .WithAlert("Alert!")
                .WithSound("default")
                .WithBadge(2));
        }

        foreach (Receipient in GCMUsers)
        {
            push.QueueNotification(NotificationFactory.AndroidGcm()
                .ForDeviceRegistrationId(GCM_Device_Token_Of_Receipient)
                .WithCollapseKey("NONE")
                .WithJson("Alert!"));
        }

My problem is that I'm able to send only to one platform at a time, the code above sends only to iPhone, and if the first loop is disabled than only Android users will get the push message.

Any clue?

I can add additional code if needed.

Thanks!

user1553825
  • 160
  • 1
  • 1
  • 6

2 Answers2

0

Have a look at

.WithExpiry()

to specify a expiration date for the message you sent.

BaesFr
  • 3
  • 2
0

I created a windows service that gets the list of ios users and android users and for each calls an instance of the pushbroker object and processes as you have above. You'll have multiple threads processing all ios and android.

user1453999
  • 158
  • 4
  • 14