In my application some texts are posting in the Twitter. Each time while posting in the twitter "Authorize app" comes and user have to authorize the application each time while posting text in the twitter. I want user have to authorize the application for the first time not the each time. I have used the twitter sample code from the github. Please help me to solve the issues. Thanks.
You're better off using Twitter4j library, it's listed on the official site (has unofficial status though)
You most likely are using twitter-android-sdk which can only auth over WebView, which is very limiting.
The up-to-date way to use Twitter API is to use oAuth and Twitter4j can do that, check out the link above, it has examples.
UPD
Also, if posting to Twitter is not your app's main purpose (like you want to give the user the ability to share something but they won't be doing so 60% of the time), you're better off using an Intent broadcast to share your content - that way if user has Twitter app installed, they won't have to authorize in your app at all, more details here and here if you are targeting API14+
Related
I have to post multiple photos to Facebook from Android application.
Can anyone help me how can I do that?
Thanks in advance.
You can download the Facebook Android SDK and integrate it into your application.
Then use this link to be able to log in the user into your Facebook application, thereby acquiring a valid access token. Make sure to ask for the publish_stream permission.
Then you have to make the appropriate graph API call to upload photos. Calling general graph API is explained here.
The method to post photos to a user's facebook is done using the /{album-id}/photos, /{user-id}/photos or directly to the user's wall through /{user-id}/feed. The appropriate endpoints are listed out here.
It would also help if you show what progress you have made in your attempt so far, but because it was a general question, this is a fairly general answer.
In my app I want to have a link or button that can use stored credentials to login to social media sites - say facebook. But, since I plan on having a multiple links/buttons to different sites that may use different login info, I cannot force users to login to my app using any of the social media credentials.
Please forget the storing of credentials for now - that is a different issue altogether.
My question is Can I send the user's info to Facebook to allow them to login without having to take them to the login screen? If so, where to best find the information to do that?
Sorry if this is a noob question, but I am a noob to app dev and still trying to get my direction. Any sites or links with information would be appreciated.
sorry for the answer but from my experience you need to go through Facebook API to log in an android application using facebook,same for other social network. No clue what you wanted to do use a HTTP POST with the credential ?
There is a serious security issue with what you're trying to do, because it's you're application that handles the social network credential and so you would need to encrypt them store them and so on...
So if you want to give a try to Facebook Android API it's here : https://developers.facebook.com/docs/android/getting-started/
Dealing with the Facebook API is too much easy. You will follow some steps to import it into your project. Register your App on facebook developer site. Put the facebook button into your layout.
When the user clicks on the button the API will handle all the subsequent steps starting from taking the user username and password and will reply to you with a temporary accessToken that will be valid for two months. This is the only communication way with Facebook API, if you want to give the Facebook API any info with any other way. I am sorry to tell you you will not be able to do that.
It's hard to explain in words what I'm talking about.
When you open an app on your phone, sometimes it requires you to give a username/email and password credentials. Some applications have an option to "Login with Facebook" and quickly allows the user to login to facebook. By doing this, it gives you a new account by using your facebook information (I guess?).
I know you can do this with my websites too.
My question is what is this called? does facebook devs have a specific name for this? If so, how can I implement it through android, and even through web development?
Thanks!!
UPDATE: For example: When you log into this stackoverflow site. You are able to click on the "login with Facebook" and quickly login without have to fill in information. I know it's the same way with the stackoverflow android app.
Facebook uses OAuth 2.0.
Related: OAuth Facebook API Tutorial
I think you are looking for the word "OpenID". Facebook logins are OpenIDs. Allowing users to use the same credentials for different webpages
What you are looking for is called Facebook Single Sign-On. The facebook developer docs should be enough to get you started.
I would like to integrate Facebook into an application - enable login using Facebook credentials (Single Sign On, to login to a third-party service), and also share some wall posts.
The problem is, I don't want to depend on the installation of the official Facebook app.
I heard about some solution involving opening Facebook login from a WebView, but didn't find details.
Anyone has experience with that?
Thanks
Yes you can do it using the OAuth for getting permission, then use the Graph API to post on users walls.
Please see this link for OAuth: http://developers.facebook.com/docs/authentication/
And this link for Graph API documentation:
http://developers.facebook.com/docs/reference/api/
especially for posting http://developers.facebook.com/docs/reference/api/post/
All Facebook APIs built on the idea that you perform request from a particular application (identified by application id). So the answer is NO, you cannot perform API queries (as well as authentication) without having registered an app.
I'm adding social integration to my app, and am looking for general advice how to go about it.
At the moment the app is showing feed of particular Facebook wall (authentication handled by Facebook's Android SDK) and feed for particular Twitter hashtag. That's a start, but I want these feeds to do a bit more. For Facebook:
For long feed items, user should be able to "see more", including linked pictures
Links inside feed items should work and open in browser
Like/unlike feed items
Comment on feed items
Post on the wall (create another item in feed)
Similarly, for Twitter:
Links inside tweets should work and open in browser
Reply to, and retweet tweets
Create tweets that contain the specific hashtag
Since Facebook and Twitter both have comprehensive APIs and there are enough code samples floating around, this is all technically doable, but seems a lot like reimplementing Facebook and Twitter clients. That's a lot of work to get all the little details right, maintain code for API changes,
and not really in the scope of my app.
So I'm thinking how to avoid reimplementing Facebook and Twitter clients.
Idea one: direct user to mobile versions of the respective sites and be done with it. Downside is that user will have to go through cumbersome authentication, even if there are dedicated client apps already installed and authenticated on user's device.
Idea two: plug into existing apps using intents system: if official Twitter app is installed, use that to do hashtag search. If Seesmic or Twidroid or some other twitter client is installed, use that. As a fallback, open Twitter's mobile website in browser. Similar for Facebook. Downside here is that intents for "show facebook stream" or "search tweets for X" are not standartized. Most current apps don't even have documented ways to plug into them. Using undocumented entry points in those apps is possible but would make my app hacky and brittle.
So, this question, how you've been dealing with integrating bits of Facebook and Twitter functionality in your apps, or seen done by others?
Here is a good tip about how to implement twitter/facebook oauth:
Create new activity and name it OAuthActivity.
Create new class that extends WebView.
Follow the facebook developer guide for WEB applications (not mobile ones!) and implement oauth calls inside of your WebView. For Twitter use Signpost-core with signpost-commonshttp4 to get oauth (facebook uses its own variation of oauth so you need to do it yourself).
Override WebView so it closes itself when facebook redirects your WebView subclass to your callback url.
Use OAuthActivity to return OAuth key / secret to your main activity via RunActivityForResult.
This way screen orientation change will work; you will have same architecture for FB and TW.
I have implemented it this way, yet I can not share my code (it is licensed for my company).
When I added Facebook and Twitter integration into my app (shameless plug: Secret Message), I attempted to invoke an installed Twitter client app via Intent. It wasn't fun, because there is no such thing as a "facebook/text" or "twitter/text" Intent. I know some Twitter apps create their own, but they're not universally used or even known.
So the other option is to get a list of all installed apps and filter on those you want to display in a chooser for the user to select. But retrieving a list of packages and their user-friendly names takes forever. So I hated that option.
I ended up integrating a very simple GUI for both Facebook and Twitter into my own app, and just used OAuth to authenticate users.
I hope this helps you pick your direction.
implementing Twitter integration is pretty easy on Android (you can use Twitter4J which is a pretty nice Twitter Java Library to access the public web services).
To integrate tweeting/retwreeting is basic stuff once you have authenticated your twitter user (just have a text box to allow users to enter thei 140 characters and a button to submit it - creating tweets, retweeting, replying etc is all a matter of 1 or 2 lines of code using twitter4J). The link stuff requires formating your listview to handle weblinks and open as appropriate.
The toughest part of the whole twitter integration thing is getting the OAuth stuff done - there is a tutorial on how to implement twitter and the OAuth authentication stuff here
Unfortunately, I have never tried facebook integration, but hopefully someone will be able to help out with that.