Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA - Send class over GCM in android

let's say I have a class called "MyClass". I need to send it from my server to an Android phone over GCM. Now, I am doing this by sending its all fields seperately and constructing MyClass again on the phone. Is there any way to send an object directly over GCM?

like image 588
EvanBlack Avatar asked Sep 11 '26 23:09

EvanBlack


1 Answers

Instead of sending all the fields separately, you can encode them to your favorite serialized format (XML, JSON, etc...) and pass the String representation of the object in a single field. Then your app would need to have a method to deserialize the object from that field.

like image 177
Eran Avatar answered Sep 13 '26 12:09

Eran