android lollipop and socket.io not working together

346 views Asked by At

I have a simple chat application on nodejs with [email protected] module.The chat app works fine with android 4.x.But I tried on android 5.0.I got some errors.
errors on server log:
errors on server log

What is the relationship of this error with android version differences?

This error may be releated to the json.I saw.There are experiencing problems with json in Android lollipop 5.0.Does anyone have experience with this issue?

UPDATE:
When I debug,I discovered that:

if (jsObj != null)
    socket.emit("bla", jsObj);

jsObj is not null.But I get the null jsobj on the server-side after emitted.Why??

1

There are 1 answers

0
erginduran On

Finally, I found a solution.JsonObject doesn't work properly in the android lollipop(5.0).So I tried

CustomObject customObject=new CustomObject();//from my customObject.class
customObject.setValue(customValue);//setter from customObject.class
Gson gson=new Gson();
String json=gson.toJson(customObject);

instead of:

 JsonObject jsonObj=new JsonObject();
 jsonObj.addProperty("value",customValue);

and so worked properly.
I hope this solution helps you too.
Regards.