From e55ff09242a5165595afb3f125b5600ba9677cbd Mon Sep 17 00:00:00 2001 From: WhalenSun Date: Fri, 7 Jun 2024 15:03:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9registerReceiver=E5=8A=A0=E4=B8=8AAndr?= =?UTF-8?q?oid12=E7=89=88=E6=9C=AC=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/hub/device/android/core/mqtt/TXAlarmPingSender.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hub/hub-device-android/src/main/java/com/tencent/iot/hub/device/android/core/mqtt/TXAlarmPingSender.java b/hub/hub-device-android/src/main/java/com/tencent/iot/hub/device/android/core/mqtt/TXAlarmPingSender.java index c2adc49e..04fbf454 100644 --- a/hub/hub-device-android/src/main/java/com/tencent/iot/hub/device/android/core/mqtt/TXAlarmPingSender.java +++ b/hub/hub-device-android/src/main/java/com/tencent/iot/hub/device/android/core/mqtt/TXAlarmPingSender.java @@ -66,7 +66,11 @@ public void start() { String action = TAG + TXMqttConstants.PING_SENDER + mComms.getClient().getClientId(); TXLog.d(TAG, "Register alarmreceiver to Context " + action); if (mContext != null && mAlarmReceiver != null) { - mContext.registerReceiver(mAlarmReceiver, new IntentFilter(action), RECEIVER_NOT_EXPORTED); + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { + mContext.registerReceiver(mAlarmReceiver, new IntentFilter(action), RECEIVER_NOT_EXPORTED); + } else { + mContext.registerReceiver(mAlarmReceiver, new IntentFilter(action)); + } } int flags = PendingIntent.FLAG_UPDATE_CURRENT;