parse.com - Parse Push Notification for Everyone or for selective device using core java -


i using parse push notification. finding problems push java desktop application. target everyone , selected android device. tried code below , getting status done zero. can me implement this?

          httpurlconnection conn;          outputstreamwriter wr;          bufferedreader rd;         jsonobject obj = null;          string application_id = "";         string rest_api_key = "";         string push_url = "https://api.parse.com/1/push"; 

might not sending enough details server. below parameters enough or more need.>

        string type = "android";         map<string, string> data = new hashmap<string, string>();         data.put("alert", "push data test");         jsonobject jo = new jsonobject();         jo.put("type", type);         string[] channels = new string[] { "" };         jo.put("channels", channels);         jo.put("data", data);         jo.put("title", "hi man!!");         jo.put("alert", "helo world!!!");         jo.put("alert", "helo world!!!");         string line, response;         // httpurlconnection created         url url = new url(push_url);         conn = (httpurlconnection) (new url(push_url)).openconnection();         conn.setdooutput(true);         conn.setrequestproperty("x-parse-application-id", application_id);         conn.setrequestproperty("x-parse-rest-api-key", rest_api_key);         conn.setrequestproperty("content-type", "application/json");         // sets connection timeout of 8sec         conn.setconnecttimeout(8000);         wr = new outputstreamwriter(conn.getoutputstream());         wr.write(jo.tostring());         wr.flush();         rd = new bufferedreader(new inputstreamreader(conn.getinputstream()));         response = "";         line = "";         // read response server         while ((line = rd.readline()) != null) {             response = response + line;         }         wr.close();         rd.close(); 


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -