Monday, 26 August 2019

Independent network module - regardless of library used

Problem :
We have a large android application, whose development started 3 years ago. At that time, devs used Volley for networking. Now we want to replace it with Retrofit. As the app is huge, it will take time and effort to do that.
Solution:
I want to develop a separate network module, which can be used with any project along with default app module. In future, if we get better networking libraries then we should not have to change app module. Problem in developing this approach is Retrofit instance is tightly coupled with interface having all apis information.
Perfect solution we want:
from app module, send base_url, endpoint, headers, body, Request bean, Response bean type to network module. Network module will call the api and provide callback. Replacing retrofit with any xyz library in future should not affect in app module.



from Independent network module - regardless of library used

No comments:

Post a Comment