From d577c956e106cf413d323f1bb99fdd8d648e41f0 Mon Sep 17 00:00:00 2001 From: Antonio <75667466+AntonioShare@users.noreply.github.com> Date: Tue, 24 Dec 2024 17:33:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(sample):=20=E5=A4=A7=E4=BA=8EAPI=2033?= =?UTF-8?q?=EF=BC=8C=E5=B9=BF=E6=92=AD=E6=8F=92=E4=BB=B6case=EF=BC=8C?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 大于API 33,广播插件测试case,运行崩溃 --- .../usecases/receiver/TestDynamicReceiverActivity.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/sample/source/sample-plugin/sample-app/src/main/java/com/tencent/shadow/sample/plugin/app/lib/usecases/receiver/TestDynamicReceiverActivity.java b/projects/sample/source/sample-plugin/sample-app/src/main/java/com/tencent/shadow/sample/plugin/app/lib/usecases/receiver/TestDynamicReceiverActivity.java index 0289a893f..685f66206 100644 --- a/projects/sample/source/sample-plugin/sample-app/src/main/java/com/tencent/shadow/sample/plugin/app/lib/usecases/receiver/TestDynamicReceiverActivity.java +++ b/projects/sample/source/sample-plugin/sample-app/src/main/java/com/tencent/shadow/sample/plugin/app/lib/usecases/receiver/TestDynamicReceiverActivity.java @@ -22,6 +22,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.View; @@ -69,7 +70,12 @@ public void onClick(View v) { } }); - registerReceiver(new DynamicBroadcastReceiver(), new IntentFilter(INTENT_ACTION)); + DynamicBroadcastReceiver dynamicBroadcastReceiver = new DynamicBroadcastReceiver(); + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) { + registerReceiver(dynamicBroadcastReceiver, new IntentFilter(INTENT_ACTION), Context.RECEIVER_EXPORTED); + } else { + registerReceiver(dynamicBroadcastReceiver, new IntentFilter(INTENT_ACTION)); + } }