Twitter app sends wrong activity result after successfully tweet creation
I compose a tweet in my app and then launch the Twitter app to create that tweet in the user's profile. Below is the code to compose a Tweet and run the Twitter app.
TweetComposer.Builder builder = new TweetComposer.Builder(this).text(tweetText);
Intent intent = builder.createIntent();
startActivityForResult(intent, TWEET_REQUEST_CODE);
Then I read whether a successor was created or not via the following code:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode = TWEET_REQUEST_CODE && resultCode == RESULT_OK) {
//do some operation
}
}
The problem is that I am getting resultCode = RESULT_CANCELED
in onActivityResult
instead of RESULT_OK
despite the Tweet being successfully created in the Twitter app and appearing in the user's timeline and hence the question Why am I getting a CANCEL RESULT instead of RESULT_OK? I tried to find the cause of the error by checking the object data
in onActivityResult
, but it is also null. Is there another way to find out more about why the app is sending RESULT_CANCELED
?
Also, I do not handle user login in my application and let the Twitter application handle this for me. Below is the setup code for Fabric:
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig), new TweetComposer());
Twitter SDK version: 2.3.2
Twitter version: 6.48.0
source to share
No one has answered this question yet
Check out similar questions: