I have implemented first time retrofit in my android code and facing follwing issues
getting following error : java.lang.IllegalArgumentException
You are using the Android internal Json APIs. You need to use Gson's classes instead.
Call sendLocation(@Body JsonObject jsonObject);
Hence the import statement
import com.google.gson.JsonObject;
Another error is passing the Callback as a parameter to the request
Call call = apiService.sendLocation(jsonObject);
call.enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) {
Log.d("response","Getting response from server : "+response);
}
@Override
public void onFailure(Call call, Throwable t) {
Log.d("response","Getting response from server : "+t);
}
});