I am making a restful API call from Android device to populate a list view .
I have used swagger codegen to generate my retrofit client .
Dagger 2 for dependency injection
Device : Asus Zenfone 5
I have tried to make call from postman, web and also in emulator (genymotion) it is much faster compared to a real device.
And interesting thing is that every time when I restart my phone for two to three request the response time is normal and after that getting slower.
I read some blog regarding gzip compression in okHTTP and try to implement that but no effect.
It would be really helpful if someone can help me to figure out the issue.
Retrofit is a type-safe HTTP networking library used for Android and Java. Retrofit was even better since it was super fast, offered better functionality, and even simpler syntax. Most developers since then have switched to using Retrofit to make API requests.
Retrofit is type-safe REST client for Android and Java which aims to make it easier to consume RESTful web services. We'll not go into the details of Retrofit 1. x versions and jump onto Retrofit 2 directly which has a lot of new features and a changed internal API compared to the previous versions.
In Android, Retrofit is a REST Client for Java and Android by Square inc under Apache 2.0 license. Its a simple network library that used for network transactions. By using this library we can seamlessly capture JSON response from web service/web API.
Retrofit is a REST Client for Java and Android allowing to retrieve and upload JSON (or other structured data) via a REST based You can configure which converters are used for the data serialization, example GSON for JSON.
In retrofit, it does following work:
Retrofit
class. In your phone, I think 1,2,3 won't be necessary, they can even be done on main thread or cached. In my device (Qcom615, 2Gram), it will take less than one ms.
So you need to debug with your network.
fix problem one by one:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With