大佬教程收集整理的这篇文章主要介绍了android – Facebook登录 – 注销问题无效密钥哈希错误,同时尝试再次登录,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
但是,在我从应用程序注销后,我尝试再次登录,但facebook提供了无效的密钥哈希错误.
请注意,我第一次成功登录并注销,但在我退出并尝试再次登录后,Facebook会出现该错误.应该做什么?
谢谢你的关注.
这是我的代码:
public class MainFragment extends Fragment { private static final String TAG = MainFragment.class.getSimplename(); private UiLifecycleHelper uiHelper; private final List<String> permissions; public MainFragment() { permissions = Arrays.asList("user_status"); } @Override public void onCreate(Bundle savedInstanceStatE) { super.onCreate(savedInstanceStatE); uiHelper = new UiLifecycleHelper(getActivity(),callBACk); uiHelper.onCreate(savedInstanceStatE); } @Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceStatE) { View view = inflater.inflate(R.layout.activity_main,container,falsE); LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton); authButton.setFragment(this); authButton.setReadPermissions(permissions); return view; } @Override public void onResume() { super.onResume(); // For scenarios where the main activity is launched and user // session is not null,the session state change notification // may not be triggered. trigger it if it's open/closed. Session session = Session.getActiveSession(); if (session != null && (session.isOpened() || session.isClosed()) ) { onSessionStateChange(session,session.getState(),null); } uiHelper.onResume(); } @Override public void onActivityResult(int requestCode,int resultCode,Intent data) { super.onActivityResult(requestCode,resultCode,data); uiHelper.onActivityResult(requestCode,data); } @Override public void onPause() { super.onPause(); uiHelper.onPause(); } @Override public void onDestroy() { super.onDestroy(); uiHelper.onDestroy(); } @Override public void onSaveInstanceState(Bundle outStatE) { super.onSaveInstanceState(outStatE); uiHelper.onSaveInstanceState(outStatE); } private void onSessionStateChange(Session session,SessionState state,Exception exception) { if (state.isOpened()) { Log.i(tag,"Logged in..."); } else if (state.isClosed()) { if (Session.getActiveSession() != null) { Session.getActiveSession().closeAndClearTokenInformation(); } Session.setActiveSession(null); Log.i(tag,"Logged out..."); } } private Session.StatusCallBACk callBACk = new Session.StatusCallBACk() { @Override public void call(Session session,Exception exception) { onSessionStateChange(session,state,exception); } };
}
以上是大佬教程为你收集整理的android – Facebook登录 – 注销问题无效密钥哈希错误,同时尝试再次登录全部内容,希望文章能够帮你解决android – Facebook登录 – 注销问题无效密钥哈希错误,同时尝试再次登录所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。