Using retrofit 2 and a custom Gson converter I'm getting a serialization issue at the api endpoint from a specific device (Samsung Galaxy s9). The following is my Gson config;
new Builder()
.baseUrl(API_BASE_URL)
.addConverterFactory(GsonConverterFactory.create(getGson()));
public static Gson getGson() {
return new GsonBuilder()
.setDateFormat(GSON_DATE_FORMAT)
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.registerTypeAdapter(Long.class, new LongTypeAdapter())
.setLongSerializationPolicy( LongSerializationPolicy.STRING )
.create();
}
Testing with a Sony Xperia premium, objects reach the api as they should, for example:
{
client_id: '07cffbe0-6df9-4b08-a524-f19b265c17be',
country: 'xxxx',
email: 'xxxx',
first_name: 'xxxx',
last_name: 'xxxx',
....
}
but on a Samsung Galaxy S9 I get:
{
a: '07cffbe0-6df9-4b08-a524-f19b265c17be',
b: 'xxxx',
c: 'xxxx',
d: 'xxxx',
e: 'xxxx',
....
}
Why would the serialization change on a different device?