3

I have Wp8.1 Silverlight app that receives push notification (WNS) from Mobileservice (the old azure service).

I therefore wanted to update to the new service because of the new features. I have now created/upgraded a new server to use App Service - Mobile App. And tested push notification with the sample app from azure (everything works).

Going back to my app WP8.1 -> Adding the new package Microsoft.Azure.Mobile.Client through NuGet (2.0.1), there is the issue that the Microsoft.WindowsAzure.Mobile.Ext does not contain the 'GetPush' extension. It seems like it is missing it? looking to the WP8 version, it only registers to MPNS, and I need WNS. So I do not know if any other assembly could be used.

Can I add another assembly reference?

Update

The following code lets me register the device on the server, and I can see the device register correctly. where the channelUri and the installationInformation are retrieved by the client and send to the server.

Installation ins = new Installation();
ins.Platform = NotificationPlatform.Wns;
ins.PushChannel = uTagAndChan.ChannelUri;
ins.Tags = uTagAndChan.Tags;
ins.InstallationId = uTagAndChan.installationInformation;
await hubClient.CreateOrUpdateInstallationAsync(ins);

Sending a test toast-notification to the registered tags, results in the following error :

The Token obtained from the Token Provider is wrong

Searching on this issue I found Windows Store App Push Notifications via Azure Service Bus. Which the proposed solution says to register to the notification hub directly from the app, I would rather not have the app to have directly access to the hub. But is this the only way? (mind you the answer was not accepted, but I will try it all though it is not a desired solution)

Update

Registering for notifications via client (WP8.1 Silverligt), makes a registration to MPNS, which I do not want.

The snippet on the server registers a WNS, the two registrations can be seen here:

Example of the registrations

The URI retrieval is done using

var channel = await Windows.Networking.PushNotifications.PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

which in the description states it returns a WNS. This seems to infer that the registration I am doing on the server (code snippet in the top) is correct and the registration on the client is faulty.

But the registration on the image seems wrong. Shouldn't the PNS Identifier be different for the two registrations? also expiration date seems wrong ?

How to mend this since the GetPush() (which was available in the sample registered the client correctly for notifications) does not exist in the NuGet package?

Update

I read one place that deleting and recreating the NotificationHub could help. I will try this today. Even IF it works, it would be more desirable to have the solution, and to know if the registrations are done correctly?

Temporary solution:

Deltede, recreated, inserted Package SID and Secret. And it works again (strange)!

Still interested in the underlying issue!

Community
  • 1
  • 1
JTIM
  • 2,774
  • 1
  • 34
  • 74
  • It's a little hard to figure out now, but my suspicion is that the Secret was wrong. The PNS identifier is tied to the device+app registration, not to the user, so it makes sense it is the same. – Adrian Hall May 05 '16 at 19:57
  • @JTIM did you resolve your issue? – Alex Belotserkovskiy May 08 '16 at 08:50
  • @AlexBelotserkovskiy I am able to send notifications yes, but no I do not know what the issue was. Deleted and recreated the service, and that helped ? – JTIM May 09 '16 at 20:04
  • I think Adrian may comment, as for me it looks like the intermittent issue that should not happen again. Glad it was resolved. – Alex Belotserkovskiy May 09 '16 at 21:20

2 Answers2

1

Deleted and recreated the service, setting all the same settings made it work again.

JTIM
  • 2,774
  • 1
  • 34
  • 74
1

I had same issue with my UWP. But in my case I had issue with self signed certificate.

When I set the AppxPackageSigningEnabled property to True (in .csproj) then notifications stopped working and I got "The token obtained from the Token Provider is wrong" (Test send from Azure Portal).

The certificate must have same issuer as Publisher in Identity element in .appxmanifest file.

blackgreen
  • 34,072
  • 23
  • 111
  • 129
Pavel
  • 11
  • 3