Skip to content

Commit 534a6e3

Browse files
author
rakatyal
committed
Merge pull request #600 from phonegap-build/raghav/wp8fix
[WP8] Updating docs and fixing the first registeration issue
2 parents 2df9565 + 1c5ea29 commit 534a6e3

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,14 +545,15 @@ if(device.platform == "Win32NT"){
545545
channelHandler,
546546
errorHandler,
547547
{
548-
"channelName": channelName,
549-
"ecb": "onNotificationWP8",
550-
"uccb": "channelHandler",
551-
"errcb": "jsonErrorHandler"
548+
"channelName": "channelName",
549+
"ecb": onNotificationWP8,
550+
"uccb": channelHandler,
551+
"errcb": jsonErrorHandler
552552
});
553553
}
554554

555555
```
556+
Make sure that date and time settings are correct for your device/emulator before registering for push notifications.
556557

557558
#### channelHandler (WP8 only)
558559
Called after a push notification channel is opened and push notification URI is returned. [The application is now set to receive notifications.](http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202940(v=vs.105).aspx)

src/wp8/PushPlugin.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ public void register(string options)
2929
if (pushChannel == null)
3030
{
3131
pushChannel = new HttpNotificationChannel(this.pushOptions.ChannelName);
32-
32+
SubscribePushChannelEvents(pushChannel);
3333
try
3434
{
35-
pushChannel.Open();
35+
var count = 0;
36+
while(count < 3 && pushChannel.ChannelUri == null)
37+
{
38+
pushChannel.Open();
39+
count++;
40+
}
3641
}
3742
catch (InvalidOperationException)
3843
{
@@ -43,8 +48,10 @@ public void register(string options)
4348
pushChannel.BindToShellToast();
4449
pushChannel.BindToShellTile();
4550
}
46-
47-
SubscribePushChannelEvents(pushChannel);
51+
else
52+
{
53+
SubscribePushChannelEvents(pushChannel);
54+
}
4855
var result = new RegisterResult
4956
{
5057
ChannelName = this.pushOptions.ChannelName,

0 commit comments

Comments
 (0)