当我尝试在数据流上推送JSONObject
时,我已正确构建JSONObject
,但之后我尝试将其发布到流中空。
JSONObject position = new JSONObject();
try {
position.put("lat", location.getLatitude());
position.put("lng", location.getLongitude());
} catch (JSONException e) {
System.out.println("json not work");
e.printStackTrace();
}
System.out.println(position) //result: {"lat":37,"lng":-122}
pubNub.publish().message(position)//never sent, if other type it works
答案 0 :(得分:0)
尝试pubNub.publish().message(position.toString());