修复直播间分享闪退问题---设置广播动态注册时expord属性

This commit is contained in:
老皮 2024-11-05 13:29:39 +08:00
parent 841adbcd17
commit b6a5fbf313

View File

@ -3,7 +3,9 @@ package com.yunbao.share;
import android.content.Context;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.RequiresApi;
import androidx.core.content.FileProvider;
import com.twitter.sdk.android.tweetcomposer.TweetUploadService;
@ -15,12 +17,18 @@ import java.io.File;
public abstract class AbsShareInterface {
protected final Context mContext;
@RequiresApi(api = Build.VERSION_CODES.TIRAMISU)
public AbsShareInterface(Context context) {
this.mContext = context;
IntentFilter filter = new IntentFilter(TweetUploadService.UPLOAD_SUCCESS);
IntentFilter filter = new IntentFilter();
filter.addAction(TweetUploadService.UPLOAD_SUCCESS);
filter.addAction(TweetUploadService.UPLOAD_FAILURE);
filter.addAction(TweetUploadService.TWEET_COMPOSE_CANCEL);
context.registerReceiver(new TwitterResultReceiver(), filter);
TwitterResultReceiver receiver = new TwitterResultReceiver();
context.registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED);
}
public abstract void share(ShareBuilder builder, ICallback callback);