From b6a5fbf3139a1713fceea718ac530201c0ffe632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=9A=AE?= <14840170+lao-pi123@user.noreply.gitee.com> Date: Tue, 5 Nov 2024 13:29:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=92=AD=E9=97=B4?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=97=AA=E9=80=80=E9=97=AE=E9=A2=98---?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=B9=BF=E6=92=AD=E5=8A=A8=E6=80=81=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E6=97=B6expord=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/share/AbsShareInterface.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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);