i'd tweet android service class. have implemented tweeting android activity class , working fine. however, service class i'm not able same. here snippet used. have used twitter4j library. status string.
configurationbuilder builder = new configurationbuilder(); builder.setoauthconsumerkey(constants.consumer_key); builder.setoauthconsumersecret(constants.consumer_secret); sharedpreferences msharedpreferences; msharedpreferences = getapplicationcontext() .getsharedpreferences("mypref", 0); final string pref_key_oauth_token = "oauth_token"; final string pref_key_oauth_secret = "oauth_token_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);
Comments
Post a Comment