retrofit2

OkHttp enable/disable gzip compression on requests

懵懂的女人 提交于 2021-02-18 20:59:42
问题 I'm using Retrofit to manage my requests and want to make some tests to check de request size using or not using gzip. By default does OkHttp performs gzip compression to requests or it must be implemented with an interceptor? I've added @Headers({ "Accept-Encoding: gzip, deflate", "Content-Encoding: gzip" }) or: @Headers({ "Content-Type: application/json;charset=utf-8", "Accept: application/json" }) to my requests and did not see any change on the request length. 回答1: OkHttp will do

SEND JSON ARRAY RETROFIT 2 (ANDROID)

安稳与你 提交于 2021-02-18 14:29:46
问题 I'm novice and know there are many post for this question but i don't find my answer. So, I need to upgrade a user and his agenda with retrofit2 and the Request "PATCH". But, i don't know how do that with Retrofit2. Even with my research ... Nothing work ! Can you help me please ? Thx for advance :D Here is what I have to send : { "gender": "M", "trainerName": "Patrick", "laterality": "L", "email": "xxxx@gmail.com", "phoneNumber": "XXXXX", "agendaWeekDays": [ { "position": 1, "startSeconds":

SSLProtocolException with HTTPs on Retrofit2

折月煮酒 提交于 2021-02-18 12:45:09
问题 I am running into an issue on Android 4.4 phones (specifically, Galaxy S4, although I believe it's not the fault of the phone itself). While using Retrofit2.Http I receive the following error while connecting on HTTPS: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x737510d0: Failure in SSL library, usually a protocol error error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741

Why is RxJava often used with Retrofit?

谁说我不能喝 提交于 2021-02-17 08:36:50
问题 What is the benefit of using Retrofit in combination with Rxjava? 回答1: Question Retrofit Already in run on background thread. Then why need another background task RxJava? I think most importanly, avoid nested callbacks( callback hell ). e.g) Callback hell (Retrofit) public interface MyService { @GET("users") Call<List<UserModel>> getUser(); @GET("userinfo") Call<UserInfoModel> getUserInfoById(@Query("id") Integer id); } service.getUser().enqueue(new Callback<UserModel>() { @Override public

Retrofit 2: No virtual method newJsonReader(Ljava/io/Reader;) NoSuchMethodException

坚强是说给别人听的谎言 提交于 2021-02-16 20:23:41
问题 I am searching for this error whole internet, but yet, only one stackoverflow entry with no answer or comment. I am trying to use Retrofit 2. It is my first time using it. Here are my dependencies: compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'com.google.code.gson:gson:2.6.2' I exclued any OkHttp libraries as Retrofit already uses it. This is my request interface: public interface LoginService { @POST(HTTPService.AUTHENTICATIO

I can auto increment id in room database but when refresh database it's shows double

蹲街弑〆低调 提交于 2021-02-13 12:58:47
问题 In my app firstly i am fetching data from server using retrofit then it's saved in room database table then it shows in recyclerview but when i using a id as a primary key it's show only one data then this id i annotat autoGenerate = true then it's show all data which i put in server but when i reopen my app,it's show double data(this mean firstly i have 3 data in server,this app show 3 data but when i reopen or refresh my database it's show 6 data ,every time in refresh it's increasing).but

I can auto increment id in room database but when refresh database it's shows double

旧街凉风 提交于 2021-02-13 12:56:51
问题 In my app firstly i am fetching data from server using retrofit then it's saved in room database table then it shows in recyclerview but when i using a id as a primary key it's show only one data then this id i annotat autoGenerate = true then it's show all data which i put in server but when i reopen my app,it's show double data(this mean firstly i have 3 data in server,this app show 3 data but when i reopen or refresh my database it's show 6 data ,every time in refresh it's increasing).but

I can auto increment id in room database but when refresh database it's shows double

核能气质少年 提交于 2021-02-13 12:54:16
问题 In my app firstly i am fetching data from server using retrofit then it's saved in room database table then it shows in recyclerview but when i using a id as a primary key it's show only one data then this id i annotat autoGenerate = true then it's show all data which i put in server but when i reopen my app,it's show double data(this mean firstly i have 3 data in server,this app show 3 data but when i reopen or refresh my database it's show 6 data ,every time in refresh it's increasing).but

Retrofit Calling the Magneto API using @FormUrlEncoded getting issue while sending the data to the magneto server

本小妞迷上赌 提交于 2021-02-11 12:52:22
问题 override fun submitSupportTicket(createSupportTicket: MutableLiveData, question: String, details: String, department: String, filePath: String) { var getSupporttUrl = "https://xxxxxxxx/V1/ecomapi/postNewSupportTicket" if (filePath.isEmpty()) { /* var getDepartmentInput = Constants.getDefaultParameterJasonInput(Constants.getUserId()) getDepartmentInput.put("questionText",question) getDepartmentInput.put("detailText",details) getDepartmentInput.put("departmentId",department)*/ /* val requestMap