ullstrm
ullstrm

Reputation: 10170

Azure Mobile Services Push not working

I am trying to implement push to my app.

I've followed this guide: http://azure.microsoft.com/en-us/documentation/articles/mobile-services-javascript-backend-ios-get-started-push/

However, I am using API's instead of the Data-scripts, so in one of my API methods I am doing this:

   var push = request.service.push;


   push.apns.send(null, {
    alert: "Alert",
    payload: {
        inAppMessage: "Hey, a new item arrived"
    }
   }, {
    success: function(resp) {
        console.log(resp)
    },
    error: function(err) {
        console.error(err)
    }
   });

My log is showing this (So I land in the success-method [Also I know that I should never land in error for iOS due to apples push server not responding with error]):

{ isSuccessful: true,
  statusCode: 201,
  body: '',
  headers: 
   { 'transfer-encoding': 'chunked',
     'content-type': 'application/xml; charset=utf-8',
     server: 'Microsoft-HTTPAPI/2.0',
     date: 'Mon, 20 Oct 2014 11:31:21 GMT' },
  md5: undefined }

My app is registered correctly like this, I see the callback message and no error:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken: (NSData *)deviceToken
{
    [client.push registerNativeWithDeviceToken:deviceToken tags:@[@"uniqueTag"] completion:^(NSError *error)
    {
        NSLog(@"registerNativeWithDeviceToken callback");
        if (error != nil)
        {
            NSLog(@"Error registering for notifications: %@", error);
        }
    }];
}

But no push message land in my iphone! Nothing is happening.

Im trying to check for errors in my Notification Hub but I see no log there.

What am I missing? I really don't get it where my actual device id is stored server side anyway. I must be missing something.

Thank you!

Upvotes: 0

Views: 1241

Answers (2)

Youngjae
Youngjae

Reputation: 25080

Use your debug menu in Azure as @Todd Reifsteck said, and please test the tag name both "myTag" and myTag while debugging.

Upvotes: 0

Todd Reifsteck
Todd Reifsteck

Reputation: 188

The best way to debug what is occurring is to follow the Notification Hub debugging steps here: http://msdn.microsoft.com/en-us/library/azure/dn530751.aspx

I would begin by using Service Bus Explorer to double-check the registration has the device token and tags you expect. After verifying that, please test sending an alert directly via the Notification Hub portal. If you still have issues, please send me an email at [email protected].

Upvotes: 2

Related Questions