Some time we need to simulate push notification into our android device for testing purpose .
This facilty is still not provided into inbuilt android sdk .
But same can be achived from online api testing site called Hurl.it
Below are steps for that
Step 1 : In the Destination combo box select Post
Step 2: Click on Add headers button and put the following values for name and vale
name = "Authorization" value= "key=YOU_GOOGLE_API_KEY"
name="Content-Type" value ="application/json"
Step 3: Click on Add Body and put the json values into following format
Step 4 :put "https://android.googleapis.com/gcm/send" in url filed
{
- "registration_ids":[
- "sdfsdfsdf",
- "GCM REGISTRATION TOEKM OF YOUR DEVICE"
- "data":{
- "message":"testing",
- "usertype":"driver",
- "bookingid":"8"
registration_ids and data are mandatory fields and under data u can send any string data
Step 4: click on Launch Request
You can see the response in following formate
{"multicast_id": 4635199670770759000,"success": 1,"failure": 1,"canonical_ids": 0,"results": [{"error": "InvalidRegistration"},{"message_id": "0:1382190107462279%63ac093bf9fd7ecd"}]}
I've got 401 unauthorized :/
ReplyDeleteAlternate-Protocol: 443:quic
Cache-Control: private, max-age=0
Content-Type: text/html; charset=UTF-8
Date: Sat, 30 Nov 2013 13:05:29 GMT
Expires: Sat, 30 Nov 2013 13:05:29 GMT
Server: GSE
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
BODY view raw