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.
Related
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.
I'm new to Facebook SDK.
So as far as I read from their tutorial, when you use custom button with their loginManager, it starts an intent of webview or the native FB app to ensure the login.
So my question, is there a way to make it custom ? like using edittext of android to get the username/password then start the login session.
Thanks.
Regards.
You can not do that for security reasons. With the facebook sdk, your app open a webview or the facebook app if the user already has installed.
If you want to save some user data, you have to set the proper permissions and you can get it with the user token and the facebook graph api.
Regards!!
I have an app which uses the Facebook SDK for various stuff (sharing, like etc).
My problem is that; inside my app, I also show an WebView which exposes a webpage with Facebook Comments (Social Plugin). My problem is that, a user which login to facebook using the Facebook SDK also has to login to facebook inside the WebView.
So my question is: Is there any way to use an access-token (or any other way) to create a facebook session cookie that I can set so that the user is also logged in to facebook inside the WebView?
No, you cannot use an access token to create an FB cookie. This is by design and is for user security.
I am trying to add a LIKE button to my android app that the user can press to like a fan page.
To my understanding, this is not possible because of Facebook security restrictions.
My alternative is to display a Like button using WebView with the "like social html code" provided by Facebook.
The issue with that approach is that the user will have to re-login to Facebook using the web interface for him to see the like button. That is, after he already logged in using the SDK authentication (which is also a web view).
Is it possible to do all of that using only one login?
How is it that logging in using the SDK does not save the cookies to the default web browser (the SDK uses a web view...) ?
Are there any alternatives to accomplish that?
Try logging into your application with SSO. Non SSO(Normal) authentication uses the Facebook application installed on the app. If you do a SSO FB login into your app and simply pass a url to webView for the "Like" feature, I guess it should work because you are using a SSO FB login for the app and pre installed facebook app on the device to handle the webview's FB.
I am hopeful about this. Please share your feedback.
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.