How to use Guest Authentication in Android? - No Callback Method is called



I can’t get Guest Authentication to work. Here is what I’m doing:

Created a new Project in Android Studio with Fabric Plugin. Codesnippets from my MainActivity:

private TwitterApiClient twitterApiClient;

protected void onCreate(Bundle savedInstanceState) {
  TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
  Fabric.with(this, new Twitter(authConfig));
  twitterApiClient = getTwitterApiClient();

public TwitterApiClient getTwitterApiClient() {
    TwitterCore.getInstance().logInGuest(new Callback<AppSession>() {
        public void success(Result<AppSession> result) {
            Log.d(Statics.TAG, "loginGuest.callback.success called");
            AppSession guestAppSession =;
            twitterApiClient = TwitterCore.getInstance().getApiClient(guestAppSession);

        public void failure(TwitterException exception) {
            Log.d(Statics.TAG, "loginGuest.callback.failure called");
            // unable to get an AppSession with guest auth
            throw exception;

    return twitterApiClient;

When I debug my app, I see that no callback is called, neither success nor failure - and twitterApiClient is always null. Did someone get Guest Authentication in Android to work? So how?

Currently the following Versions are used:

Would appreciate any tips!
Best, Thorsten


ok i solved it. TwitterCore.getInstance().logInGuest is asynchronous. So of course, the twitterApiClient member isn’t set in my synchronous getTwitterApiClient call, but later on, when the callback is called.

closed #3