Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post to GCM - response invalid JSON? #175

Open
GoogleCodeExporter opened this issue Mar 7, 2016 · 1 comment
Open

post to GCM - response invalid JSON? #175

GoogleCodeExporter opened this issue Mar 7, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
uaing v0.26.7, trying to POST @ google cloud messaging

a)the post must contain headers like :
"Authorization", "key=yourkeyhere"
"Content-Type", "application/json"

the only way I found (searching internet) is to create a 
AjaxCallback<JSONObject> cb;

-set the url
-set the header 
-set the params

always the response is code - 400 writes :
JSON_PARSING_ERROR: Unexpected character (d) at position 0.
or
JSON_PARSING_ERROR: Unexpected token END OF FILE at position 0

shot : http://i.imgur.com/vFF3hJL.png


----------

the post parameters must be like (PHP) :
    $fields = array('registration_ids' => $registrationIDs, 
            'data' => array("message" => $message), );

array['registration_ids'] = 12312
array['data'] = array['message'] = "hello"


I tried post parameters via :
-Map<String, Object> params = new HashMap<String, Object>();
-List<NameValuePair> pairs = new ArrayList<NameValuePair>() + 
UrlEncodedFormEntity
-HashMap<String, JSONObject>

no idea.... how to..

keep in mind when there is no valid header, returns 401 Authorized

Original issue reported on code.google.com by yotag...@gmail.com on 19 Feb 2014 at 6:22

@GoogleCodeExporter
Copy link
Author

solved, with AQuery.POST_ENTITY

Original comment by yotag...@gmail.com on 22 Feb 2014 at 11:46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant