Questions tagged [retrofit2.6]

55 questions
10
votes
1 answer

Retrofit 2.6.0: Custom Coroutines CallAdapterFactory

I need to do custom error handling in my api and I wanted to use coroutines with the new version of Retrofit. Since we don't have to use Deferred any longer, our own Jake Wharton wrote this on reddit a month…
Leonardo Deleon
  • 2,577
  • 5
  • 15
  • 22
6
votes
2 answers

Retrofit 2 on sdk < 21

I used Retrofit library in my android application. My project's minSDK is 16. Now I see that my apps not working on SDK < 21 because of retrofit version. My retrofit version: implementation 'com.squareup.retrofit2:retrofit:2.6.1' implementation…
Behrooz Fard
  • 536
  • 4
  • 26
4
votes
2 answers

Two questions about providing instance of HttpLoggingInterceptor for OkHttpClient in Dagger 2 module

I am developing an Android project with Kotlin and Dagger 2. I have a NetworkModule it is supposed to provide a singleton instance of Retrofit. in which I define all those provider functions. All code snippet below are inside NetworkModule…
user842225
  • 5,445
  • 15
  • 69
  • 119
3
votes
1 answer

WorkManager job doesn't get rescheduled or it doesn't fire after some time

I´ve been facing a issue with WorkManager when reescheduling jobs. Currently, I´ve found that at some point after launching a request with Okhttp and raising an error on AuthInterceptor it gets stuck and no other job gets launched. This is the…
reixa
  • 6,903
  • 6
  • 49
  • 68
3
votes
0 answers

Retrofit 2 - Field is not working with @FormUrlEncoded when targeted sdk is Android Pie but @Body is working fine

I am trying to make the Api call using Retrofit 2 POST method with @Field and @FormurlEncoded in Android but it just doesn't work in Android PIE. I have integrated Apis using retrofit thousands of time before. But this time I have targeted sdk…
Sagar Shah
  • 4,272
  • 2
  • 25
  • 36
2
votes
1 answer

Need help Kotlin Coroutines, Architecture Component and Retrofit

I'm trying to wrap my head around the mentioned components and I can't get it right. I want to do something very simple: Fetch data from the network and present it to the user. Currently am not yet caching it as am still learning new Coroutine…
1
vote
0 answers

how to get the value from random number api using retrofit?

URL : https://www.randomnumberapi.com/api/v1.0/random using the above api im unable to get the values as String or either int, can someone help me how to get this value inside my code? here's what i tried main class code: Retrofit retrofit = new…
Santhosh
  • 11
  • 1
1
vote
1 answer

How to define retrofit MultipartBody.Part Part Name in API Interfacce

How can I define MultipartBody.Part Part Name in the API Interface. So I want to define @Part image: MultipartBody.Part To be like @Part("image") image: MultipartBody.Part So I want some way that I can omit "image" from…
Malik Bilal
  • 869
  • 8
  • 25
1
vote
1 answer

In retrofit, how can I use Tag in the request as a parameter value without using Call?

Retrofit: I want to use Tag annotation to pass some data in the request, and then I would like to intercept that data from the interceptor. Something like this How can I use it something like this, but without using…
Ahmad Shahwaiz
  • 1,432
  • 1
  • 17
  • 35
1
vote
0 answers

Retrofit connecting to different URL instead of base URL

I am trying to connect to a specific BASE_URL but Retrofit throws an error and says cannot connect with BASE_URL/13.127.91.230:80. I dont know what this added 13.127.91.230:80 is Now I can verify that the latter URL does not work, but why is…
Shubham Rohila
  • 366
  • 2
  • 12
1
vote
0 answers

Coroutines with Retrofit crashing with no stack trace when calling `RequestBody.create`

I am using Retrofit with coroutines (built in support). I have a Retrofit interface, retrofit implementation and the API implementation created by Retrofit, but it doesn't matter as it doesn't get called. It crashes before that, here: In…
Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
1
vote
0 answers

How to get upload progress percentage in retrofit mulitpart request?

Following is the multipart request that i am performing using retrofit2. What i want is to somehow get a callback of the upload percentage. But i cannot a find a suitable method for doing this. I have saw few methods but they are only playing with…
Malik Bilal
  • 869
  • 8
  • 25
1
vote
1 answer

Retrofit response.errorBody cannot be converted to JsonObject or Java Obejct

When the API is called it return an object in onScuccess with status code 201 and when not in onSuccess along with status code 422 it also gives an object like this { "errors": [ "Usuário não encontrado" ] } I have tried many ways…
Faizan Haidar Khan
  • 1,099
  • 1
  • 15
  • 20
1
vote
2 answers

Retrofit 2.6.2 is not working on Vodafone mobile data but works fine on WiFi

Please help me Some of my app users are complaining or giving feedback that their app doesn't work on mobile data (Vodafone 4G) but works on wifi. I am using Retrofit-2.6.2 and okhttp3 - 4.2.2. Retrofit.Builder() .baseUrl(baseurl) …
DeePanShu
  • 1,236
  • 10
  • 23
1
2 3 4