Facebook - Show facebook user Feed in webview like browser - android

Thank you in advance to see my Question.
I have task of facebook in my android application. I have to integrate Facebook SDK for Authentication by facebook. When I use facebook api to get the feed of user that time i got the #JSON response from the server side.
So I made the custom layout to show that user's feed.
But I need to show load the user feed in my webview in Android.
So Facebook provide any #Url for the user feed to load that Url webview? so we show facebook feed like #browser.

Officially it is not possible to pass the Facebook SDK Token to a WebView. As far as I know it is currently not possible to do it.
One workaround I used in one of my apps (to display a like button before it was part of the SDK) is to set the Login Dialog to web only. By doing this the Facebook SDK creates a LoginDialog using a WebView whereby it has an active Facebook session after login.
This can be done by setting the LoginBehaviour of either the LoginManager or the LoginButton:
login.setLoginBehavior(LoginBehaviour.WEB_ONLY);
Please be aware that this is only a workaround and could stop working in the future.

Just open m.facebook.com directly, this way it will take you to user's wall after login. and As its already logged in by authentication, session will remain active.

Related

Using the Facebook SDKs WebView to show custom web page?

I'm wondering if it's possible to use Facebooks Android SDK to open up a Facebook WebView but instead of showing facebook related stuff I wanna show my custom page which is using Facebook Comments Social Plugin.
The reason? I wanna make use of the cookies that are stored in that WebView so that a user doesn't need to login again if he's already been logged in. And in the case that he's not logged in, he can login using the SDKs Login Flow.
Is any of this possible?
Thank you!

Displaying a fan page in a UIWebView with an authenticated user session using Facebook's access token

We're developing an app for iOS and Android that has a rather odd requirement. One of the tabs of the app opens up the client's Facebook page. So here's our desired functionality:
The user logs in using Facebook's SDKs (for iPhone and Android)
We retrieve the access token and our application flow starts
When the user clicks the Facebook Page tab we load a UIWebView pointing to the URL of Facebook page.
The user should be able to interact with the Facebook page right away.
So what happens is steps 1-3 work normally. However, because this UIWebView hasn't been authenticated on Facebook before, it doesn't have a valid session. Hence the user is required to login again in this web view in order to interact with the page.
Is there a way to use the token that we have from the Facebook login process when loading the UIWebView in order to avoid having to sign in again?
Thanks.
I haven't tried wht are you trying. But i am opening other user's profile page,and its working. I am doing it this way. https://graph.facebook.com/search?q=SEARCH_STRING&type=user&access_token=USER_ACCESS_TOKEN. Hope it will help you.

How to login into facebook in WebView if already have access token from FB SDK in Android

I'm developing android app in which I have login via Facebook SDK. In app I also have facebook social comments displayed in webview. But problem is even if user is logged through fb sdk, the webview doesn't know about it and for posting new comment it requires user to login.
My question is: Is there any way how to pass login from facebook sdk session to webview? For example by some javascript function to which I give access token string and call it on webview so it gets logged in and ready for posting comments?
Thanks :)
So with what I figured out to this point, there is no way how to pass loged session to WebView.
Here is my solution to this problem: At your remote server make webpage with login interface using Facebook JavaScript SDK and then display it in WebView. This way all WebViews in your app will share same login cookie and everything will work as you want.
Or you can load m.facebook.com directly, but this way it will take you to user's wall after login. Above solution offers you to display another content after login as users picture and info only (with log out button of course).
Hope it helps :)
If some user still want to use facebook login page, you can try to use the android Javascript Interface to pass the access_token to the Android Facebook SDK.
You can try to pass the access_token from the native sdk to the webview via query string.
myWebView.loadUrl('http://mydomain.com/?access_token=' + facebookAccessToken);
And in your webview check if the access_token is set and use it with the javascript sdk, hope it helps someone with the same issue.
Facebook Rest API service is already deprecated.
You can user Facebook SDK to login and access details from facebook. Check the facebook documentation.
https://developers.facebook.com/docs/android/login-with-facebook/v2.2
Did you try out the tutorials in developers.facebook.com/, here they clearly given how to login. Once you logged in the details of the user will be cached, if you need to publish any data you might need permission for that, so you will be directed to login activity once more. Its given in this link

How to make applicationn with Facebook API

I have made an application in which I have used the Facebook API. It is working properly but it shows me the Facebook login page on first view. But I want particular page of Facebook instead of the Facebook login page. How and where can I pass the URL of a particular page on the API of the Facebook login page?
You are using the API incorrectly. The API allows your phone to have access to a user's profile data, not load pages. If you want to point the user to a specific page, you can do that through the browser. If you want the user to be able to post on a wall or do some other functionality through your app, you must get the data from the user in some way (through facebook's prebuilt dialogs for android, or your own GUI) and then form a request to the facebook API with the correct values.
See the Graph API documentation, which will tell you what you can and can't do with the facebook API.

Create Facebook API-like WebView pop-up in Android

I have Facebook and Twitter integration in my app. For Facebook I use the API they provided and for Twitter I open a WebView for Oauth.
To save the Twitter key I get back from Oauth I have to use CallBack. However using CallBack lets the user see a black screen (for less than a second) before going to the activity with the sharing options.
Is there a way I can avoid this black screen.
Or better:
Can I make a WebView pop-up like the Facebook API does? If yes, how can I achieve this and how can I save the key I get back from Oauth?
I had the same problem that you and I created a Twitter Login Button library which do the same as the Facebook Login Button provided in the example of the Android API.
You can found the code on Google Code.
Basically it display a webview containing Twitter website to allow the user to click on Allow and save the token and token secret. You can easily use this library with Twitter4j for example.

Categories

Resources