From b06370422b9641f40789498ad60aeb5acdbb860e Mon Sep 17 00:00:00 2001 From: hacen-ai <75481145+hacen-ai@users.noreply.github.com> Date: Sun, 24 Apr 2022 11:33:19 +0200 Subject: [PATCH] Update BackgroundSmsPlugin.java --- .../j/background_sms/BackgroundSmsPlugin.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/android/src/main/java/com/j/background_sms/BackgroundSmsPlugin.java b/android/src/main/java/com/j/background_sms/BackgroundSmsPlugin.java index 6ba58ac..d9d6bb7 100644 --- a/android/src/main/java/com/j/background_sms/BackgroundSmsPlugin.java +++ b/android/src/main/java/com/j/background_sms/BackgroundSmsPlugin.java @@ -60,25 +60,17 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { } private void isSupportCustomSim(Result result){ - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ + result.success(true); - }else{ - result.success(false); - } + } private void sendSMS(String num, String msg, Integer simSlot,Result result) { try { SmsManager smsManager; - if (simSlot == null) { - smsManager = SmsManager.getDefault(); - } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - smsManager = SmsManager.getSmsManagerForSubscriptionId(simSlot); - } else { - smsManager = SmsManager.getDefault(); - } - } + + smsManager = SmsManager.getSmsManagerForSubscriptionId(simSlot); + smsManager.sendTextMessage(num, null, msg, null, null); result.success("Sent"); } catch (Exception ex) {