File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
android/src/main/java/com/printerimin Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -86,16 +86,20 @@ public PrinterIminModule(ReactApplicationContext reactContext) {
8686 super (reactContext );
8787 this .reactContext = reactContext ;
8888 // List<String> modelList = Arrays.asList(modelArry);
89- if (Build .MODEL .contains ("W27_Pro" ) || Build .MODEL .contains ("I23D" ) || Build .MODEL .contains ("I23M" ) || Build .MODEL .contains ("I24D" ) || Build .MODEL .contains ("I24T" ) || Build .MODEL .contains ("I24M" )) {
90- //初始化 2.0 的 SDK。
91- PrinterHelper .getInstance ().initPrinterService (reactContext );
92- sdkVersion = "2.0.0" ;
93- }
89+ // if (Build.MODEL.contains("W27_Pro") || Build.MODEL.contains("I23D") || Build.MODEL.contains("I23M") || Build.MODEL.contains("I24D") || Build.MODEL.contains("I24T") || Build.MODEL.contains("I24M")) {
90+ // //初始化 2.0 的 SDK。
91+ // PrinterHelper.getInstance().initPrinterService(reactContext);
92+ // sdkVersion = "2.0.0";
93+ // }
9494 // if (modelList.contains(Build.MODEL)) {
9595 // //初始化 2.0 的 SDK。
9696 // PrinterHelper.getInstance().initPrinterService(reactContext);
9797 // sdkVersion = "2.0.0";
9898 // }
99+ if (isAndroid15 ()) {
100+ PrinterHelper .getInstance ().initPrinterService (reactContext );
101+ sdkVersion = "2.0.0" ;
102+ }
99103 else {
100104 //初始化 1.0 SDK
101105
@@ -2049,4 +2053,13 @@ public Map<String, Object> getConstants() {
20492053 return constants ;
20502054 }
20512055
2056+ public static boolean isAndroid15 () {
2057+ // 假设Android 15的API级别是34(实际数字将在Android 15发布时确定)
2058+ final int ANDROID_15_API_LEVEL = 32 ;
2059+ // 获取当前设备的API级别
2060+ int currentApiLevel = Build .VERSION .SDK_INT ;
2061+ // 判断是否是Android 15
2062+ return currentApiLevel >= ANDROID_15_API_LEVEL ;
2063+ }
2064+
20522065}
Original file line number Diff line number Diff line change 11{
22 "name" : " react-native-printer-imin" ,
3- "version" : " 0.10.4 " ,
3+ "version" : " 0.10.5 " ,
44 "description" : " Native Module For iMin Printer SDK Plugin" ,
55 "main" : " lib/commonjs/index" ,
66 "module" : " lib/module/index" ,
161161 }
162162 ]
163163 ]
164+ },
165+ "dependencies" : {
166+ "react-native-device-info" : " ^14.0.4"
164167 }
165168}
You can’t perform that action at this time.
0 commit comments