29 lines
1.1 KiB
Java
29 lines
1.1 KiB
Java
package com.yunbao.share.receiver;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.util.Log;
|
|
|
|
import com.twitter.sdk.android.tweetcomposer.TweetUploadService;
|
|
import com.yunbao.common.utils.ToastUtil;
|
|
|
|
public class TwitterResultReceiver extends BroadcastReceiver {
|
|
@Override
|
|
public void onReceive(Context context, Intent intent) {
|
|
Log.i("分享log", "onReceive: "+intent.getAction());
|
|
if (TweetUploadService.UPLOAD_SUCCESS.equals(intent.getAction())) {
|
|
ToastUtil.show("推特分享成功");
|
|
// success
|
|
final Long tweetId = intent.getExtras().getLong(TweetUploadService.EXTRA_TWEET_ID);
|
|
} else if (TweetUploadService.UPLOAD_FAILURE.equals(intent.getAction())) {
|
|
// failure
|
|
ToastUtil.show("推特分享失败");
|
|
final Intent retryIntent = intent.getExtras().getParcelable(TweetUploadService.EXTRA_RETRY_INTENT);
|
|
} else if (TweetUploadService.TWEET_COMPOSE_CANCEL.equals(intent.getAction())) {
|
|
// cancel
|
|
ToastUtil.show("推特分享取消");
|
|
}
|
|
}
|
|
}
|