PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

Implement Serializable

Open comann opened this issue 10 years ago • 5 comments

For the data model that wraps the protobuf objects, can they be made to be serializable? All protobuf objects have a toBytes and parseFromBytes method that are easily accessible. This would tremendously help in android usages.

comann avatar Jul 22 '16 20:07 comann

im not an android developer so fogive me, can you give some use cases? i cant seem to think of a case where you would want to serialize and parse back later (the objects could be outdated/invalid, as they are retrieved from the PGO server).

Grover-c13 avatar Jul 23 '16 09:07 Grover-c13

I think his referring to the way that android transfer data from a controller to another by serializing and deserializing every time, so he is asking to us to make all data model like Pokemon.java implement the Serializable interface from Java.

vmarchaud avatar Jul 23 '16 10:07 vmarchaud

There are many faster ways to serialize objects in Android. For example with Moshi and a custom Adapter.

FabianTerhorst avatar Jul 23 '16 13:07 FabianTerhorst

While you are right. This project maintains itself in pure java. This is why I suggested serializable.

comann avatar Jul 23 '16 13:07 comann

Serializable is not the correct format for this. You can implement your own Parcelable wrapper classes if you really really want to. Otherwise I do not suggest passing these values through bundles, but instead passing any auth tokens and recreating the AuthInfo class and PokemonGo or storing them on an Application-scoped object.

Aphoh avatar Jul 25 '16 03:07 Aphoh