diff --git a/Share/src/main/java/com/yunbao/share/AbsShareInterface.java b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java index fed5ddee8..3cc2c45ec 100644 --- a/Share/src/main/java/com/yunbao/share/AbsShareInterface.java +++ b/Share/src/main/java/com/yunbao/share/AbsShareInterface.java @@ -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);