Atlas加载Facebook登录的远程Bundle设计

RemoteFragment

使用RemoteFragment方式,在onActivityResult回调时报错

1
2
3
4
5
6
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
NLog.i(TAG, "FacebookLoginFragment.onActivityResult");
super.onActivityResult(requestCode, resultCode, data);
mCallbancManager.onActivityResult(requestCode, resultCode, data);
}
1
2
3
4
Class not found when unmarshalling: com.facebook.login.LoginClient$Result
java.lang.ClassNotFoundException: com.facebook.login.LoginClient$Result

Caused by: java.lang.ClassNotFoundException: Can't find class com.facebook.login.LoginClient$Result in BundleClassLoader: com.lianlianpay.europa_sign, dependencies=[], thread=Thread[main,5,main]

参考:https://developers.facebook.com/support/bugs/1621984714705591
参考:https://developers.facebook.com/support/bugs/1721610004736672

大概原因是com.lianlianpay.europa_sign插件在回调onActivityResult时没有Facebook的依赖,因此找不到com.facebook.login.LoginClient$Result

startActivity

1
2
3
4
5
6
7
AppBundleHelper.bundleExplicitly(mActivity, "facebook", "me.yezhou.lib", new AtlasBundleLoadedListener() {
@Override
public void onBundleLoaded() {
AtlasDelegateHelper.startBundleActivityForResult(mActivity, ActivityConfig.ACTIVITY_SOCIAL_FACEBOOK_LOGIN, IntentCode.REQUEST_FACEBOOK_LOGIN.ordinal());
mActivity.overridePendingTransition(R.anim.push_bottom_in, R.anim.push_bottom_out);
}
});

注意设置FacebookLoginActivity的背景为透明,让用户看不出有页面跳转的痕迹

1
2
3
4
5
<style name="Transparent" parent="AppTheme">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :