android - Send push notification with data using JSON -
i want send push notification data in it. example send parse
 { "phoneid": "ejw6pfsqny", "action": "com.parse.starter.update_status" }
how can send android device. using following code
jsonobject obj = null; try {      obj = new jsonobject();     obj.put("phoneid",pass);     obj.put("action","com.parse.starter.update_status"); } catch (jsonexception e) {     e.printstacktrace(); } parsepush push = new parsepush(); parsequery query = parseinstallation.getquery(); // notification android users query.whereequalto("objectid", pass); log.d("log",pass); push.setquery(query); push.setdata(obj); push.setmessage(pass); push.sendinbackground();   and code use retrieve data
  jsonobject notificationpayload = new jsonobject(intent.getextras().getstring("com.parse.data"));                  id = notificationpayload.getstring("phoneid");   but not working.
you can't both setdata , setmessage. documentation says if call one, overwrite other. in case, calling setmessage overwrite setdata call. 
Comments
Post a Comment