android - Fabric: TwitterSession always null -


i want check if user connected on twitter in order post tweets android application. using fabric, check twittersession via code:

twittercore twittercore = twittercore.getinstance(); twittersession twittersession = twittercore.getsessionmanager().getactivesession(); return (twittersession != null && !twittersession.getauthtoken().isexpired()); 

the problem twittersession null, if i'm connected on twitter application.

how can solve problem?

you have initialize in oncreate firstly. used twitter digits , initilize somthing :

 twitterauthconfig authconfig = new twitterauthconfig(twitter_key, twitter_secret);         fabric.with(this, new answers(), new twittercore(authconfig), new digits());         strictmode.setthreadpolicy(new strictmode.threadpolicy.builder()                 .detectall()                 .penaltylog()                 .build());          strictmode.setvmpolicy(new strictmode.vmpolicy.builder()                 .detectall()                 .penaltylog()                 .build());          final digits digits = new digits.builder()                 .withdigitseventlogger(new answerslogger())                 .build(); 

i think @ this page


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -