From fddd8f6dcd807029715348db0367721c06b8477c Mon Sep 17 00:00:00 2001 From: Margus Salk Date: Thu, 8 Aug 2024 18:39:52 +0300 Subject: [PATCH] Fix getting EuiccManager --- .../java/com/reactnativesimcardsmanager/EsimModule.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/reactnativesimcardsmanager/EsimModule.java b/android/src/main/java/com/reactnativesimcardsmanager/EsimModule.java index f272687..3a52190 100644 --- a/android/src/main/java/com/reactnativesimcardsmanager/EsimModule.java +++ b/android/src/main/java/com/reactnativesimcardsmanager/EsimModule.java @@ -20,10 +20,14 @@ public class EsimModule { @RequiresApi(api = Build.VERSION_CODES.P) public EuiccManager getMgr() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P || mgr == null) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { return null; } + if (mgr != null) { + return mgr; + } + mgr = (EuiccManager) mReactContext.getSystemService(EUICC_SERVICE); return mgr; }