Android Facebook SDK 3.23.0 - FB Login on AndroidTV

可紊 提交于 2019-12-02 00:48:48

Correct. Also, Facebook API currently does not support Android TV. So it'll not be possible for you to build an app with Facebook Login on Android TV (unless you wanna write your own library for it). Hence, no D-Pad support and the messed up function of the text fields.

This is taken directly from the documentation

Note: You can use the WebView class for logins to services like Google+ and Facebook.

I assume they are suggesting the use of a WebView, but not necessarily by means of the Facebook SDK (whose WebView might be custom/limited).

You can login with facebook on android tv, to do this you must first enable logging in from devices. Products - Facebook Login - Settings - Login from Devices - set to yes.

And for logging in you must use the DeviceLoginManager.

mDeviceLoginManager = DeviceLoginManager.getInstance();
        mDeviceLoginManager.registerCallback(mCallbackManager, facebookCallback);
 mDeviceLoginManager.setLoginBehavior(LoginBehavior.DEVICE_AUTH);
        mDeviceLoginManager.logInWithReadPermissions(this, Collections.EMPTY_LIST);

This will open a webview with a code.

Olya Kusaeva

For me this was very helpful:

The solution was to execute the following javascript on my WebView in

onPageFinished():

webView.loadUrl("javascript:document.getElementsByName('email')[0].focus();");

Obviously this will only work with the Facebook sign in screen, since they have a text field with name 'email'.

Source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!