I have been developing android apps for few years. Recently i have used MVP architecture in my app and after reading through a lot and making use of this Android10 github repo.
But there are few questions i have around this MVP architecture which i am looking for. Please help me to understand these better.
1) So i have three module app, domain, data. Which module presenters will go. In some app they have it in domain but i saw some other libraries have it in presentation or app module like this https://github.com/android10/Android-CleanArchitecture.
2 ) Can presenters have android related stuffs like Intents, Contexts, SharedPrefs ets? I don't think this should happen.
3) Can data module talk with app module and vice versa Or app module should talk to domain module which in term executes the things on data module
4 ) How can i do social login like Facebook with MVP architecture... any idea or link to explain? I have done that in a below way:
Activity: onFBButtonClick()
--> presenter.onButtonClick()
--> FacebookLoginManager.registerCallback
After this i directly get a callback on my activity on onActivityResult(int requestcode, int resultcode, Intent intent)
. Now according to fb sdk tutorial i have to call FbCallbackManager.onActivityResult(with all the params)
. But I can't pass these information in presenter as presenter should not know about intent(Platform Specific) thing. How can i now call FbcallbackManager.onActivity()
?
There are many approaches to implementation of MVP in Android.
Most of the approaches I've seen designate Activity/Fragment as MVP view. This seems natural initially, but too many issues and questions raises when you try to apply this scheme to a non-trivial applications.
After I investigated many MVP approaches (incl. the ones you linked), I came to a conclusion that neither Activity no Fragment should be MVC views.
The detailed reasoning behind this claim is summarized here: Why Activities are not UI Elements.
Following this line of sight, I proposed another implementation of MVP for android applications: MVP and MVC Architectures in Android.
As for your questions:
Also, as for FB integration, please see my answer here.
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