使用MVP模式的Android登录实现

时间:2017-01-22 11:17:06

标签: java android facebook facebook-login mvp

我需要使用Model-View-Presenter(MVP)模式在我的应用程序中实现facebook登录,但问题实际上是如何避免向我的演示者注入一个Activity的引用(这将取消MVP模式,因为演示者应该不包含平台组件)。

LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("email", "public_profile"));

如上所示,logInWithReadPermissins()函数将参数作为对活动的引用。

1 个答案:

答案 0 :(得分:1)

在这个存储库中,它们提供了一个很好的解决方案。

https://github.com/SergeyBurlaka/Android-MVP-FacebookSDK-GoogleAPI-SocialViewer-App

并且执行将是那样的

0,15,30,45 * * * * /bin/bash -l -c 'cd /var/app/current && bundle exec rails runner -e production 'Structure.check_parking' >> /var/app/current/log/cron_log 2>&1'

在kotlin

LoginManager.getInstance().logInWithReadPermissions((Activity) view,
            Arrays.asList("email", "public_profile"));