0

I used socialauth library share button example for posting message on all social websites wall. But it worked only for linkedin.It doesn't work for facebook,twitter etc... It authenticated but isn't posting on wall.

Please can any one help me.

Till Helge
  • 9,253
  • 2
  • 40
  • 56
suman
  • 75
  • 3
  • 8
  • Make sure that your accoun's security settings allows to do the postings. – ooops May 24 '13 at 07:54
  • Hi Suman , due to change in facebook and twitter api, we have released socialauth android 2.1 testing jar. please use it. you can find it on issue no.52 in issues list. if you face problem please let me know. – vineet May 26 '13 at 16:39
  • Hi Suman , the latest sdk is released on socialauth website. you can use it now. – vineet Jun 11 '13 at 09:07

2 Answers2

0

you can include this code to update status on twitter ..

/**
 * Function to update status
 * */
class updateTwitterStatus extends AsyncTask<String, String, String> {

    /**
     * Before starting background thread Show Progress Dialog
     * */
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(MainActivity.this);
        pDialog.setMessage("Updating to twitter...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(false);
        pDialog.show();
    }

    /**
     * getting Places JSON
     * */
    protected String doInBackground(String... args) {
        Log.d("Tweet Text", "> " + args[0]);
        String status = args[0];
        try {
            ConfigurationBuilder builder = new ConfigurationBuilder();
            builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
            builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);

            // Access Token 
            String access_token = mSharedPreferences.getString(PREF_KEY_OAUTH_TOKEN, "");
            // Access Token Secret
            String access_token_secret = mSharedPreferences.getString(PREF_KEY_OAUTH_SECRET, "");

            AccessToken accessToken = new AccessToken(access_token, access_token_secret);
            Twitter twitter = new TwitterFactory(builder.build()).getInstance(accessToken);

            // Update status
            twitter4j.Status response = twitter.updateStatus(status);

            Log.d("Status", "> " + response.getText());
        } catch (TwitterException e) {
            // Error in updating status
            Log.d("Twitter Update Error", e.getMessage());
        }
        return null;
    }

    /**
     * After completing background task Dismiss the progress dialog and show
     * the data in UI Always use runOnUiThread(new Runnable()) to update UI
     * from background thread, otherwise you will get error
     * **/
    protected void onPostExecute(String file_url) {
        // dismiss the dialog after getting all products
        pDialog.dismiss();
        // updating UI from Background Thread
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(getApplicationContext(),
                        "Status tweeted successfully", Toast.LENGTH_SHORT)
                        .show();
                // Clearing EditText field
                txtUpdate.setText("");
            }
        });
    }

}

for further details u can go for this link Here

Nandu
  • 88
  • 1
  • 10
0

using the social auth libraries we can easily post our update into the socialmedia refer this link https://code.google.com/p/socialauth-android/ also use socialauth android 2.1 testing jar. socialauth android 4.0 testing jar.