0

im using the twitter 4j lib to integrate twitter into my application. The problem im having is that no matter who is logged into the twitter app on the phone it always posts to my twitter account. what am i missing?

      Runnable runnable = new Runnable() {
            public void run() {         
                ConfigurationBuilder builder = new ConfigurationBuilder();
                builder.setOAuthConsumerKey("fTKYDUKDKN7679sHJjdjskhsjsksRs");
                builder.setOAuthConsumerSecret("dTKYDUKDKN7679sHJjdjskhsjsks");



                // Access Token 
                String access_token = "TKYDUKDKN7679sHJjdjskhsjsks";
                // Access Token Secret
                String access_token_secret = "aaTKYDUKDKN7679sHJjdjskhsjsks";

                AccessToken accessToken = new AccessToken(access_token, access_token_secret);
                Twitter twitter = new TwitterFactory(builder.build()).getInstance(accessToken);
                 //twitter.getOAuthAccessToken()
               // Update status
                try {
                    twitter4j.Status response = twitter.updateStatus("updated via myapp");

                      Log.d("Status", "> " + response.getText());

                    // Error in updating status


                } catch (TwitterException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    Log.d("Twitter Update Error", e.getMessage());
                }
                try {
                    uploadPic(file, "MY FIRST PICTURE ", twitter);
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }         

        };
  Thread mythread = new Thread(runnable);
    mythread.start();

1 Answers1

1

You are hard coding in the values for the access token and access token secret, which are likely for your account. Using your OAuth key and secret, you can obtain a user's access token and secret using the Sign in with Twitter flow.

WoogieNoogie
  • 1,258
  • 1
  • 11
  • 21