Hey guys i have implemented twitter sharing in my app and got some problem it gave 215 in response
TwitterCore.getInstance().logInGuest(new Callback<AppSession>() { @Override public void success(Result<AppSession> result) { guestAppSession = result.data; try { Log.d("guestAppSession" + guestAppSession.getAuthToken(), "=" + result.data.getId()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } try { Log.d("URL", "=" + url); DefaultHttpClient client = new DefaultHttpClient(); HttpGet method = new HttpGet(new URI(url)); HttpResponse res = client.execute(method); inputStream = res.getEntity().getContent(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); Log.d("bufferedReader_", "=" + bufferedReader.readLine()); while(bufferedReader.readLine() != null) { Log.d("bufferedReader", "=" + bufferedReader.readLine()); } } catch (Exception e) { e.printStackTrace(); } } @Override public void failure(TwitterException exception) { // unable to get an AppSession with guest auth } });
above is my code let me know what is wrong. and give me proper response to implement it... Thanks ..
Error code: {"errors":[{"code":215,"message":"Bad Authentication data."}]}
I have solved my problem as ..
TwitterCore.getInstance().logInGuest(
new Callback<AppSession>() {
@Override
public void success(
Result<AppSession> appSessionResult) {
AppSession guestAppSession = appSessionResult.data;
final TwitterApiList apiClient = new TwitterApiList(
guestAppSession);
apiClient.getListService().statuses(
" shjh", "user",
50, new Callback<List<Tweet>>() {
@Override
public void success(
Result<List<Tweet>> listResult) {
Log.d("twittercommunity",
"user's profile url is "
+ listResult.data
.get(0).user.profileBackgroundColor);
// Do something with the
// list
}
}
@Override
public void failure(
TwitterException e) {
// FAIL
}
});
}
@Override
public void failure(TwitterException e) {
e.printStackTrace();
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.