Push Notification Not working REST api

Hi

As i am working on Push Notification using REST api.
First : I have done the registration part of the device and it showing on Backenless Dashboard.
api used = “https://api.backendless.com/v1/messaging/registrations
params = {“os”:“ANDROID”,“expiration”:“2592000”,“osVersion”,“4.1.2”}

Second : I go through the Message Publish Documents and i written code and its working and showing me the correct response.
api used = “https://api.backendless.com/v1/messaging/Default
params = {“message”:“Hello Push Notification”,“pushPolicy”:“ONLY”,“pushBroadcast”,“ALL”,“headers”:(“Gas”=“Price”)}

Third : I written code of the message subscription for the same app.
api used = “https://api.backendless.com/v1/messaging/Default/subscribe
params = {“selector”:(“Gas”=“Price”)}

Now the problem is that when i am publishing message it not receiving to other side.
Like normal push notification it should show on the device but it not happend.
Is there any other process i need to do?
Please let me know the answer ASAP.

Could you check if it works when you remove the selector from the subscription side?

Also, could you check if the device shows up in console? You need to go to Messaging, then select the Devices tab .

Regards,
Mark

When i remove the selector it gives the error when calling subscription url using no params body passed.

{“message”:“Could not parse request with message: Invalid Json”,“code”:8002}

And yes the device shown on the console.

When you send a request without a body, what do you set the Content-type header to?

Content type i set as application/json…

Since there is no body, you should remove that header and try again.

i done that part and it will show me only the empty response message.

Can you give me some hint about how the process will work?

Because i don’t understand when i can use the message subscription.

Thanks

All I am asking you to do is to repeat the device registration call without the selector. Does it work? Did the device show up in console? If it did, try sending a push notification. Did it arrive?

yes it works for me…

device is also showing on console.
But i want to send push notification using mymobile.
In my app there is concept of updating Price of some items with Admin login.
When Admin done update process then push notification should arrive to all devices.

Did you get my point?

And also when i am publishing push from console it will ask me to enter publisherId.

Can you please tell me what value i passed in that?

thanks

Hi Mark,

Can you please answer me?

Thanks

Safvan,

It becomes very difficult to answer all the questions in the same thread. Please write each question in a separate post. I will answer the original question (see the very first post in this one):

If message delivery works without a selector and does not work with the selector, the problem is in the actual selector. Here’s the selector you have:

“selector”:(“Gas”=“Price”)

and here’s the proper way to write it:

“selector”:“Gas=‘Price’”

You can see an example of it here:
http://backendless.com/documentation/messaging/rest/messaging_message_subscription.htm

Regards,
Mark

Hi Mark,

As i have done that also but it give me error like this.

{“message”:“Could not parse request with message: Invalid Json”,“code”:8002}

Let me know if we can receive message without selector?

Did you remove the Content-type header from the request?