@@ -4,8 +4,10 @@ import android.app.Activity
44import android.content.BroadcastReceiver
55import android.content.ComponentName
66import android.content.Context
7+ import android.content.Context.RECEIVER_EXPORTED
78import android.content.Intent
89import android.content.IntentFilter
10+ import android.os.Build
911import com.tencent.mm.opensdk.constants.ConstantsAPI
1012import com.tencent.mm.opensdk.modelmsg.SendAuth
1113import com.tencent.mm.opensdk.openapi.IWXAPI
@@ -18,8 +20,7 @@ import javax.inject.Singleton
1820
1921@Singleton
2022class LoginManager @Inject constructor(
21- @ApplicationContext val context : Context ,
22- val appEnv : AppEnv
23+ @ApplicationContext val context : Context , val appEnv : AppEnv
2324) {
2425 private var api: IWXAPI ? = null
2526 private var wechatReceiver: BroadcastReceiver ? = null
@@ -44,7 +45,11 @@ class LoginManager @Inject constructor(
4445 }
4546 }
4647 }
47- context.registerReceiver(wechatReceiver, IntentFilter (ConstantsAPI .ACTION_REFRESH_WXAPP ))
48+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .TIRAMISU ) {
49+ context.registerReceiver(wechatReceiver, IntentFilter (ConstantsAPI .ACTION_REFRESH_WXAPP ), RECEIVER_EXPORTED )
50+ } else {
51+ context.registerReceiver(wechatReceiver, IntentFilter (ConstantsAPI .ACTION_REFRESH_WXAPP ))
52+ }
4853 }
4954
5055 fun unregisterReceiver (context : Context ) {
0 commit comments