Start a new topic

Not able to register device for push notification

Hi,


I am using Angularjs.
I want to register my device for push notification.
I am sending the following post request:


{ "Authorization": APP_SECRET,

  "data" : { "deviceId" : DEVICE_UUID,

      "platform" : "android"

    },

  "headers" : { "Content-Type": "application/json"},

  "method" : "POST",

  "url" : "https://baas.kinvey.com/push/kid_WyB3Qm2kze/register-device"

}


I am getting the following response:






POST /push/kid_WyB3Qm2kze/register-device

Authorization: Basic a2lkX1d5QjNRbTJremU6NGNlNDIyYjhmNmNkNGE5MGI5NzRlOTNmZDdkMjdjM2Y=
X-Kinvey-API-Version: 3
Content-Type: application/json

{ "Authorization": "dff253b755e8466ab4d3be7a059b2ee5",
  "data" : { "deviceId" : "81d2a1a994c36c84",
      "platform" : "android"
    },
  "headers" : {  "Content-Type": "application/json"},
  "method" : "POST",
  "url" : "https://baas.kinvey.com/push/kid_WyB3Qm2kze/register-device"
}
================

HTTP/1.1 400 
Wed Jul 01 2015 18:27:02 GMT+0530 (India Standard Time)
{
  "error": "IncompleteRequestBody",
  "description": "The request body is either missing or incomplete",
  "debug": "The request body must specify the device platform as either 'ios' or 'android'"
}


I am using the following link as reference:


http://devcenter.kinvey.com/angular/guides/push#Registeringadevice


Please help me, what am i doing wrong.


Its urgent.


Thanks in advance.




It depends on how you're provisioning your push certificate, and further, how you're pushing to it.


Can you explain to me how you have your application set up?


Thanks,

I am using kinvey console. Under engagement tab, I am using the given push option. I am quite new to kinvey. I might be missing on something. Guide me through it

Maanik, there is a guide on the console that links you to the steps to setting up your push certificate, have you followed that?

Yes, I have been following it. I have acquired the GCM Id. Configured the console following the steps given. Registered the device for push notifications. It have been assigned a message token as well. Trying to send push notifications through console.. Where I am stuck

Maanik,


How recently did you go through the GCM push guide, as we updated it recently (as google updated their push service shortly after Google I/O which was a few weeks ago).


Thanks,

Maanik, 


Is the POST above being generated by the library or by you?


Thanks,

HI Damien,

Thanks for replying.


This post request is being generated by me.
Am i not doing it in the right way?


Please share a sample, it would be helpful for me to find whats wrong here.


Thanks

Hello Maanik, 

 

Based on the guide that you linked me above I don't think that you need the "data" part of your JSON there at all.    The guide specifies to things that you are going to need to use your app's Master Secret, and that the json format should be:

{
  "platform": "ios",
  "deviceId": "device ID goes here",
  "framework": "optional: put 'titanium' if using the titanium library, omit  otherwise",
  "userId": "5058c666474f050906000001"
}

Since you are not calling this from the user context, you need to specify a user ID, there is also no "data" section that appears in the JSON.


Thanks,



a quick question.


What is user Id here?

Is it the app secret?

The user id is the _id field for the user you want to store this token for in the user collection.

oh, got it.


Thanks a lot.


I was able get a success reply using kinvey console.

But, on trying to send push notification from console,
 I updates the status as 202, says sent to 1.

but the device does not receive any notification.

what could be wrong here??



Login or Signup to post a comment