Cannot receive broadcast after compose a tweet by TweetComposer

android

#1

I’m trying to compose Tweet by TweetComposer , with the tutorial I can compose successfully.

My problem is after compose,I cannot receive the result broadcast.

I have create a BroadcastReceiver

public class TwitterReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (TweetUploadService.UPLOAD_SUCCESS.equals(intent.getAction())) {
            Log.i("share","share success");
        } else {
            Log.i("share","share fail");
        }
    }
}

and add it to the manifest.xml file

<receiver android:name=".TwitterReceiver"
                  android:exported="false">
            <intent-filter>
                <action android:name="com.twitter.sdk.android.tweetcomposer.UPLOAD_SUCCESS"/>
                <action android:name="com.twitter.sdk.android.tweetcomposer.UPLOAD_FAILURE"/>
            </intent-filter>
        </receiver>

I don’t know if I have missed something,can someone me?

Thank you!


Tweet Composer callback
#2

How are you launching the Composer? Using TweetComposer#Builder() will launch composer activity in the native Twitter Android app. In this case I don’t think any broadcast is sent. The code shown above should work when using the native composer with app install card.

Show Twitter composer: https://docs.fabric.io/android/twitter/compose-tweets.html#twitterkit-tweet-composer
Show native composer with app install card: https://docs.fabric.io/android/twitter/compose-tweets.html#twitterkit-tweet-composer


#3

Thank you for your reply.I will try it.


#4