currently, I’m building an app which will show for the user recent forecast. For make an api call, I have to provide longitude and latitude as parameter. For now, I have written some code about getting langitude, and longitude, but I don’t receive proper data. As I written those methods in MainActivity, at first, the longitude, and latitude is equal
Tag: retrofit
Interceptor throws IOException: UnknownHostException when I turn internet off
With a new version of okhttp(4.9.0, not sure if it was in lower versions) and Retrofit 2.9.0(also lower versions). I started to see in firebase and google analytics reports about UnknownHostException. I tried to repro this crash and found that it is happening when the internet is off or very low quality. I call addInterceptor in the framework layer and
I’ve received single item from api
I trying to display temperature values that came from the API response in RecyclerView. The thing is my program constantly display just one, first item. I’m not sure where can be the issue, and I feel …
Spotify PKCE. Error invalid client secret
I need to complete Authorization Code Flow with Proof Key for Code Exchange. In step 4, I get an error 400 – bad request {“error”:”invalid_request”,”error_description”:”Invalid client secret”}. Why need to client secret if it is PKCE. What do I wrong? Do you have any idea? Body request like code=abc&grant_type=authorization_code&redirect_uri=spotify-sdk%3A%2F%2Fauth&client_id=abc&code_verifier=abc Example code verifier: xeJ7Sx1lyUr0A_DAomzewuGn8vNS2cd3ZF2odDlqHEqeYKpxjnYYhpHxOohoo7lf22VNImGiOy_PE07owmDn2VmTWvdKKQ Example code challenge: N_yPRc_VC8JQJz5dYOuvvM-9cJLdAtEjJ9-lh8Xk_qI And the same
Android Retrofit Call pass response.body() as paramater for processing
I’m wondering how to pass the response.body() as paramater in order to further process it. Since now i could pass it only to a Toast, or setText of a textView, and it works just fine. But if i try to pass it to a function which saves it to SharedPrefs or something like it just passes a null object. I
List All Data Using Retrofit/OkHttp With Response List
I have some codes that fetch some data from my API. My question is how can I list all the objects that I fetched before without using this jsonData.get(0), I expect something like jsonData.get(i), so …
NPE hard to spot from the logcat it seems to be the Arraylist but each item should be set
GitHub Repo app building for learning purposes I’ve become stuck in this world of NullPointerException. So it says on line 119 the ArrayList is null it’s a simple Callback via Retrofit where I try to get the data and then set they data further on. I’m unsure of where exactly in the process it fails as it just points to
Retrofit2, Android, @Get Parsing for the Array of Array
I am parsing the title correctly and displaying it in a listview. I cant seem to access the seen below. Here are the two objects, sample response and my call. response pojo: first object second object response: I am getting the title just by passing ‘result’ into the adapter and using result[i].getTitle(); I tried using result[i].Details[0].findMe; but my error response
why use Retrofit when we have OkHttp
with OkHttp we can make HTTP request then get response from server then with Gson lib convert response to object we need. this is from Square/OkHttp doc: Its request/response API is designed with fluent builders and immutability. It supports both synchronous blocking calls and async calls with callbacks I read from stackOverFlow Retrofit uses OkHTTP automatically if available . So
Retrofit 2 – Elegant way of adding headers in the api level
My Retrofit 2 (2.0.2 currently) client needs to add custom headers to requests. I’m using an Interceptor to add these headers to all requests: Some headers I always want to add, but some headers I only need to add based on requirements of that specific endpoint, for example whether the user needs to be authenticated or not. I’d like to