react-native-beidou 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LogManager.ts CHANGED
@@ -282,3 +282,4 @@ export default BeiDouLogManager;
282
282
 
283
283
 
284
284
 
285
+
@@ -1,2 +1,2 @@
1
- #Mon Nov 17 14:26:40 CST 2025
1
+ #Thu Dec 25 15:34:06 CST 2025
2
2
  gradle.version=8.9
@@ -100,6 +100,18 @@
100
100
  <option name="screenX" value="1200" />
101
101
  <option name="screenY" value="1920" />
102
102
  </PersistentDeviceSelectionData>
103
+ <PersistentDeviceSelectionData>
104
+ <option name="api" value="35" />
105
+ <option name="brand" value="samsung" />
106
+ <option name="codename" value="a05s" />
107
+ <option name="id" value="a05s" />
108
+ <option name="labId" value="google" />
109
+ <option name="manufacturer" value="Samsung" />
110
+ <option name="name" value="A05s" />
111
+ <option name="screenDensity" value="450" />
112
+ <option name="screenX" value="1080" />
113
+ <option name="screenY" value="2400" />
114
+ </PersistentDeviceSelectionData>
103
115
  <PersistentDeviceSelectionData>
104
116
  <option name="api" value="35" />
105
117
  <option name="brand" value="samsung" />
@@ -172,6 +184,30 @@
172
184
  <option name="screenX" value="1080" />
173
185
  <option name="screenY" value="2340" />
174
186
  </PersistentDeviceSelectionData>
187
+ <PersistentDeviceSelectionData>
188
+ <option name="api" value="36" />
189
+ <option name="brand" value="samsung" />
190
+ <option name="codename" value="a26x" />
191
+ <option name="id" value="a26x" />
192
+ <option name="labId" value="google" />
193
+ <option name="manufacturer" value="Samsung" />
194
+ <option name="name" value="SM-A266B" />
195
+ <option name="screenDensity" value="450" />
196
+ <option name="screenX" value="1080" />
197
+ <option name="screenY" value="2340" />
198
+ </PersistentDeviceSelectionData>
199
+ <PersistentDeviceSelectionData>
200
+ <option name="api" value="36" />
201
+ <option name="brand" value="samsung" />
202
+ <option name="codename" value="a34x" />
203
+ <option name="id" value="a34x" />
204
+ <option name="labId" value="google" />
205
+ <option name="manufacturer" value="Samsung" />
206
+ <option name="name" value="SM-A346N" />
207
+ <option name="screenDensity" value="450" />
208
+ <option name="screenX" value="1080" />
209
+ <option name="screenY" value="2340" />
210
+ </PersistentDeviceSelectionData>
175
211
  <PersistentDeviceSelectionData>
176
212
  <option name="api" value="34" />
177
213
  <option name="brand" value="samsung" />
@@ -184,6 +220,18 @@
184
220
  <option name="screenX" value="1080" />
185
221
  <option name="screenY" value="2340" />
186
222
  </PersistentDeviceSelectionData>
223
+ <PersistentDeviceSelectionData>
224
+ <option name="api" value="35" />
225
+ <option name="brand" value="samsung" />
226
+ <option name="codename" value="a35x" />
227
+ <option name="id" value="a35x" />
228
+ <option name="labId" value="google" />
229
+ <option name="manufacturer" value="Samsung" />
230
+ <option name="name" value="A35" />
231
+ <option name="screenDensity" value="450" />
232
+ <option name="screenX" value="1080" />
233
+ <option name="screenY" value="2340" />
234
+ </PersistentDeviceSelectionData>
187
235
  <PersistentDeviceSelectionData>
188
236
  <option name="api" value="35" />
189
237
  <option name="brand" value="samsung" />
@@ -196,6 +244,18 @@
196
244
  <option name="screenX" value="1080" />
197
245
  <option name="screenY" value="2340" />
198
246
  </PersistentDeviceSelectionData>
247
+ <PersistentDeviceSelectionData>
248
+ <option name="api" value="36" />
249
+ <option name="brand" value="samsung" />
250
+ <option name="codename" value="a36xq" />
251
+ <option name="id" value="a36xq" />
252
+ <option name="labId" value="google" />
253
+ <option name="manufacturer" value="Samsung" />
254
+ <option name="name" value="SM-A366E" />
255
+ <option name="screenDensity" value="450" />
256
+ <option name="screenX" value="1080" />
257
+ <option name="screenY" value="2340" />
258
+ </PersistentDeviceSelectionData>
199
259
  <PersistentDeviceSelectionData>
200
260
  <option name="api" value="35" />
201
261
  <option name="brand" value="samsung" />
@@ -427,6 +487,19 @@
427
487
  <option name="screenX" value="1080" />
428
488
  <option name="screenY" value="2340" />
429
489
  </PersistentDeviceSelectionData>
490
+ <PersistentDeviceSelectionData>
491
+ <option name="api" value="36" />
492
+ <option name="brand" value="samsung" />
493
+ <option name="codename" value="e1q" />
494
+ <option name="default" value="true" />
495
+ <option name="id" value="e1q" />
496
+ <option name="labId" value="google" />
497
+ <option name="manufacturer" value="Samsung" />
498
+ <option name="name" value="Galaxy S24" />
499
+ <option name="screenDensity" value="480" />
500
+ <option name="screenX" value="1080" />
501
+ <option name="screenY" value="2340" />
502
+ </PersistentDeviceSelectionData>
430
503
  <PersistentDeviceSelectionData>
431
504
  <option name="api" value="34" />
432
505
  <option name="brand" value="samsung" />
@@ -439,6 +512,18 @@
439
512
  <option name="screenX" value="1440" />
440
513
  <option name="screenY" value="3120" />
441
514
  </PersistentDeviceSelectionData>
515
+ <PersistentDeviceSelectionData>
516
+ <option name="api" value="36" />
517
+ <option name="brand" value="samsung" />
518
+ <option name="codename" value="e3q" />
519
+ <option name="id" value="e3q" />
520
+ <option name="labId" value="google" />
521
+ <option name="manufacturer" value="Samsung" />
522
+ <option name="name" value="Galaxy S24 Ultra" />
523
+ <option name="screenDensity" value="450" />
524
+ <option name="screenX" value="1440" />
525
+ <option name="screenY" value="3120" />
526
+ </PersistentDeviceSelectionData>
442
527
  <PersistentDeviceSelectionData>
443
528
  <option name="api" value="33" />
444
529
  <option name="brand" value="google" />
@@ -681,6 +766,18 @@
681
766
  <option name="screenX" value="1008" />
682
767
  <option name="screenY" value="2244" />
683
768
  </PersistentDeviceSelectionData>
769
+ <PersistentDeviceSelectionData>
770
+ <option name="api" value="35" />
771
+ <option name="brand" value="motorola" />
772
+ <option name="codename" value="lamul" />
773
+ <option name="id" value="lamul" />
774
+ <option name="labId" value="google" />
775
+ <option name="manufacturer" value="Motorola" />
776
+ <option name="name" value="moto g05" />
777
+ <option name="screenDensity" value="280" />
778
+ <option name="screenX" value="720" />
779
+ <option name="screenY" value="1604" />
780
+ </PersistentDeviceSelectionData>
684
781
  <PersistentDeviceSelectionData>
685
782
  <option name="api" value="34" />
686
783
  <option name="brand" value="motorola" />
@@ -777,6 +874,18 @@
777
874
  <option name="screenX" value="1080" />
778
875
  <option name="screenY" value="2400" />
779
876
  </PersistentDeviceSelectionData>
877
+ <PersistentDeviceSelectionData>
878
+ <option name="api" value="36" />
879
+ <option name="brand" value="samsung" />
880
+ <option name="codename" value="pa2q" />
881
+ <option name="id" value="pa2q" />
882
+ <option name="labId" value="google" />
883
+ <option name="manufacturer" value="Samsung" />
884
+ <option name="name" value="S25+" />
885
+ <option name="screenDensity" value="450" />
886
+ <option name="screenX" value="1080" />
887
+ <option name="screenY" value="2340" />
888
+ </PersistentDeviceSelectionData>
780
889
  <PersistentDeviceSelectionData>
781
890
  <option name="api" value="35" />
782
891
  <option name="brand" value="samsung" />
@@ -789,6 +898,18 @@
789
898
  <option name="screenX" value="1440" />
790
899
  <option name="screenY" value="3120" />
791
900
  </PersistentDeviceSelectionData>
901
+ <PersistentDeviceSelectionData>
902
+ <option name="api" value="36" />
903
+ <option name="brand" value="samsung" />
904
+ <option name="codename" value="pa3q" />
905
+ <option name="id" value="pa3q" />
906
+ <option name="labId" value="google" />
907
+ <option name="manufacturer" value="Samsung" />
908
+ <option name="name" value="Galaxy S25 Ultra" />
909
+ <option name="screenDensity" value="600" />
910
+ <option name="screenX" value="1440" />
911
+ <option name="screenY" value="3120" />
912
+ </PersistentDeviceSelectionData>
792
913
  <PersistentDeviceSelectionData>
793
914
  <option name="api" value="33" />
794
915
  <option name="brand" value="google" />
@@ -863,6 +984,18 @@
863
984
  <option name="screenX" value="1080" />
864
985
  <option name="screenY" value="2340" />
865
986
  </PersistentDeviceSelectionData>
987
+ <PersistentDeviceSelectionData>
988
+ <option name="api" value="36" />
989
+ <option name="brand" value="samsung" />
990
+ <option name="codename" value="r9q" />
991
+ <option name="id" value="r9q" />
992
+ <option name="labId" value="google" />
993
+ <option name="manufacturer" value="Samsung" />
994
+ <option name="name" value="Galaxy S21 FE 5G" />
995
+ <option name="screenDensity" value="480" />
996
+ <option name="screenX" value="1080" />
997
+ <option name="screenY" value="2340" />
998
+ </PersistentDeviceSelectionData>
866
999
  <PersistentDeviceSelectionData>
867
1000
  <option name="api" value="36" />
868
1001
  <option name="brand" value="google" />
@@ -987,6 +1120,18 @@
987
1120
  <option name="screenX" value="1080" />
988
1121
  <option name="screenY" value="2408" />
989
1122
  </PersistentDeviceSelectionData>
1123
+ <PersistentDeviceSelectionData>
1124
+ <option name="api" value="33" />
1125
+ <option name="brand" value="samsung" />
1126
+ <option name="codename" value="y2q" />
1127
+ <option name="id" value="y2q" />
1128
+ <option name="labId" value="google" />
1129
+ <option name="manufacturer" value="Samsung" />
1130
+ <option name="name" value="S20 Plus 5G" />
1131
+ <option name="screenDensity" value="600" />
1132
+ <option name="screenX" value="1440" />
1133
+ <option name="screenY" value="3200" />
1134
+ </PersistentDeviceSelectionData>
990
1135
  </list>
991
1136
  </option>
992
1137
  </component>
@@ -68,7 +68,7 @@ repositories {
68
68
  dependencies {
69
69
  //noinspection GradleDynamicVersion
70
70
  implementation "com.facebook.react:react-native:${_reactNativeVersion}"
71
- implementation 'com.fxzs:beidousdk:1.0.7@aar'
71
+ implementation 'com.fxzs:beidousdk:1.0.8@aar'
72
72
  // Add local AAR files
73
73
  implementation fileTree(dir: "src/main/libs", include: ["*.jar", "*.aar"])
74
74
  }
@@ -10,8 +10,12 @@ import android.net.wifi.WifiInfo;
10
10
  import android.net.wifi.WifiManager;
11
11
  import android.nfc.Tag;
12
12
  import android.os.Build;
13
+ import android.os.Bundle;
14
+ import android.os.Handler;
15
+ import android.os.Looper;
13
16
  import android.util.Log;
14
17
  import android.location.Location;
18
+ import android.location.LocationListener;
15
19
  import android.location.LocationManager;
16
20
  import android.telephony.SubscriptionInfo;
17
21
  import android.telephony.SubscriptionManager;
@@ -48,6 +52,7 @@ import java.util.Map;
48
52
  import java.util.Objects;
49
53
  import java.util.ArrayList;
50
54
  import java.util.List;
55
+ import java.util.concurrent.atomic.AtomicBoolean;
51
56
 
52
57
  public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
53
58
  private ReactContext reactContext;
@@ -385,7 +390,7 @@ public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
385
390
  }
386
391
 
387
392
  @Override
388
- public void onDataReceived(String deviceNo, byte[] data, int dataType) {
393
+ public void onDataReceived(String deviceNo, byte[] data, int dataType, String uuid) {
389
394
  // 处理接收到的数据
390
395
  // byte[] cipher = Arrays.copyOfRange(data, 4, data.length);
391
396
  String message = Base64.getEncoder().encodeToString(data);
@@ -464,7 +469,7 @@ public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
464
469
  }
465
470
 
466
471
  @Override
467
- public void onDataReceived(String deviceNo, byte[] data, int dataType) {
472
+ public void onDataReceived(String deviceNo, byte[] data, int dataType, String uuid) {
468
473
  // 处理接收到的数据
469
474
  Log.d("BluetoothSDK", "writeInfo收到数据,长度: " + data.length);
470
475
  String base64String = Base64.getEncoder().encodeToString(data);
@@ -614,22 +619,29 @@ public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
614
619
  return;
615
620
  }
616
621
 
617
- boolean hasReadPhoneStatePermission = ContextCompat.checkSelfPermission(reactContext,
618
- Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED;
622
+ // 移除手动权限检查,直接调用系统API
623
+ // boolean hasReadPhoneStatePermission = ContextCompat.checkSelfPermission(reactContext,
624
+ // Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED;
619
625
 
620
- if (!hasReadPhoneStatePermission) {
621
- promise.reject("PERMISSION_DENIED", "缺少READ_PHONE_STATE权限");
622
- return;
626
+ // if (!hasReadPhoneStatePermission) {
627
+ // promise.reject("PERMISSION_DENIED", "缺少READ_PHONE_STATE权限");
628
+ // return;
629
+ // }
630
+
631
+ // 优先使用 Activity Context
632
+ Context context = reactContext.getCurrentActivity();
633
+ if (context == null) {
634
+ context = reactContext;
623
635
  }
624
636
 
625
637
  boolean hasReadPhoneNumbersPermission = true;
626
638
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
627
- hasReadPhoneNumbersPermission = ContextCompat.checkSelfPermission(reactContext,
639
+ hasReadPhoneNumbersPermission = ContextCompat.checkSelfPermission(context,
628
640
  Manifest.permission.READ_PHONE_NUMBERS) == PackageManager.PERMISSION_GRANTED;
629
641
  }
630
642
 
631
643
  WritableArray result = new WritableNativeArray();
632
- Context context = reactContext;
644
+ // Context context = reactContext; // 已在上方定义
633
645
 
634
646
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
635
647
  SubscriptionManager subscriptionManager = (SubscriptionManager) context
@@ -856,12 +868,12 @@ public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
856
868
  }
857
869
 
858
870
  /**
859
- * 获取GPS经纬度(优先返回最近一次的已知位置)
871
+ * 获取GPS经纬度(优先返回最近一次的已知位置,无缓存则主动定位)
860
872
  * - 需要定位运行时权限(ACCESS_FINE_LOCATION 或 ACCESS_COARSE_LOCATION)
861
873
  * - 返回:{ latitude, longitude, provider, accuracy, timestamp },若无可用位置则返回 null
862
874
  */
863
875
  @ReactMethod
864
- public void getGpsLocation(Promise promise) {
876
+ public void getGpsLocation(final Promise promise) {
865
877
  try {
866
878
  if (reactContext == null) {
867
879
  promise.reject("CONTEXT_NULL", "React上下文不可用");
@@ -877,51 +889,149 @@ public class BeiDouBluetoothModule extends ReactContextBaseJavaModule {
877
889
  return;
878
890
  }
879
891
 
880
- LocationManager locationManager = (LocationManager) reactContext.getSystemService(Context.LOCATION_SERVICE);
892
+ final LocationManager locationManager = (LocationManager) reactContext.getSystemService(Context.LOCATION_SERVICE);
881
893
  if (locationManager == null) {
882
894
  promise.reject("LOCATION_SERVICE_UNAVAILABLE", "无法获取定位服务");
883
895
  return;
884
896
  }
885
897
 
886
- Location gpsLocation = null;
887
- Location networkLocation = null;
888
- try {
889
- gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
890
- } catch (Exception ignored) {
891
- }
892
- try {
893
- networkLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
894
- } catch (Exception ignored) {
895
- }
896
-
898
+ // 1. 尝试获取最近已知位置(缓存)
897
899
  Location bestLocation = null;
898
- if (gpsLocation != null && networkLocation != null) {
899
- bestLocation = gpsLocation.getTime() >= networkLocation.getTime() ? gpsLocation : networkLocation;
900
- } else if (gpsLocation != null) {
901
- bestLocation = gpsLocation;
902
- } else if (networkLocation != null) {
903
- bestLocation = networkLocation;
900
+ try {
901
+ Location gpsLocation = null;
902
+ Location networkLocation = null;
903
+
904
+ try {
905
+ if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
906
+ gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
907
+ }
908
+ } catch (Exception ignored) {}
909
+
910
+ try {
911
+ if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
912
+ networkLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
913
+ }
914
+ } catch (Exception ignored) {}
915
+
916
+ if (gpsLocation != null && networkLocation != null) {
917
+ // 选择更新鲜的那个
918
+ bestLocation = gpsLocation.getTime() >= networkLocation.getTime() ? gpsLocation : networkLocation;
919
+ } else if (gpsLocation != null) {
920
+ bestLocation = gpsLocation;
921
+ } else if (networkLocation != null) {
922
+ bestLocation = networkLocation;
923
+ }
924
+ } catch (Exception e) {
925
+ Log.e("BeiDouBluetoothModule", "获取缓存位置失败: " + e.getMessage());
904
926
  }
905
927
 
906
- if (bestLocation == null) {
907
- // 没有可用的最近位置,返回null
908
- promise.resolve(null);
928
+ // 如果找到位置且位置在2分钟(120000ms)以内,认为有效,直接返回
929
+ if (bestLocation != null && (System.currentTimeMillis() - bestLocation.getTime() < 120000)) {
930
+ promise.resolve(locationToMap(bestLocation));
909
931
  return;
910
932
  }
911
933
 
912
- WritableMap map = new WritableNativeMap();
913
- map.putDouble("latitude", bestLocation.getLatitude());
914
- map.putDouble("longitude", bestLocation.getLongitude());
915
- map.putString("provider", bestLocation.getProvider());
916
- map.putDouble("accuracy", bestLocation.hasAccuracy() ? bestLocation.getAccuracy() : -1.0);
917
- map.putDouble("timestamp", (double) bestLocation.getTime());
918
- promise.resolve(map);
934
+ // 2. 如果没有位置或位置太旧,请求单次定位更新
935
+ // 切换到主线程执行定位请求
936
+ new Handler(Looper.getMainLooper()).post(new Runnable() {
937
+ @Override
938
+ public void run() {
939
+ requestSingleLocationUpdate(locationManager, promise);
940
+ }
941
+ });
942
+
919
943
  } catch (Exception e) {
920
944
  logger.e("BeiDouBluetoothModule", "获取GPS位置失败: " + e.getMessage(), e);
921
945
  promise.reject("LOCATION_ERROR", "获取GPS位置失败: " + e.getMessage(), e);
922
946
  }
923
947
  }
924
948
 
949
+ /**
950
+ * 辅助方法:将 Location 对象转为 WritableMap
951
+ */
952
+ private WritableMap locationToMap(Location location) {
953
+ WritableMap map = new WritableNativeMap();
954
+ map.putDouble("latitude", location.getLatitude());
955
+ map.putDouble("longitude", location.getLongitude());
956
+ map.putString("provider", location.getProvider());
957
+ map.putDouble("accuracy", location.hasAccuracy() ? location.getAccuracy() : -1.0);
958
+ map.putDouble("timestamp", (double) location.getTime());
959
+ return map;
960
+ }
961
+
962
+ /**
963
+ * 主动请求单次定位(带超时)
964
+ */
965
+ private void requestSingleLocationUpdate(final LocationManager locationManager, final Promise promise) {
966
+ // 选择可用的 Provider
967
+ final String provider;
968
+ if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
969
+ provider = LocationManager.NETWORK_PROVIDER;
970
+ } else if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
971
+ provider = LocationManager.GPS_PROVIDER;
972
+ } else {
973
+ promise.resolve(null); // 没有开启的Provider
974
+ return;
975
+ }
976
+
977
+ final AtomicBoolean isHandled = new AtomicBoolean(false);
978
+ final Handler handler = new Handler(Looper.getMainLooper());
979
+
980
+ final LocationListener listener = new LocationListener() {
981
+ @Override
982
+ public void onLocationChanged(Location location) {
983
+ // 确保只处理一次
984
+ if (isHandled.compareAndSet(false, true)) {
985
+ locationManager.removeUpdates(this);
986
+ promise.resolve(locationToMap(location));
987
+ }
988
+ }
989
+
990
+ @Override
991
+ public void onStatusChanged(String provider, int status, Bundle extras) {}
992
+ @Override
993
+ public void onProviderEnabled(String provider) {}
994
+ @Override
995
+ public void onProviderDisabled(String provider) {}
996
+ };
997
+
998
+ try {
999
+ // 请求定位更新:minTime=0, minDistance=0, 尽可能快地获取
1000
+ // 即使在 API 30+,requestLocationUpdates 依然有效,只是 requestSingleUpdate 被标记为 deprecated
1001
+ // 这里使用 requestLocationUpdates 模拟单次,兼容性更好
1002
+ locationManager.requestLocationUpdates(provider, 0L, 0f, listener, Looper.getMainLooper());
1003
+
1004
+ // 10秒超时机制
1005
+ handler.postDelayed(new Runnable() {
1006
+ @Override
1007
+ public void run() {
1008
+ if (isHandled.compareAndSet(false, true)) {
1009
+ // 超时后移除监听
1010
+ locationManager.removeUpdates(listener);
1011
+
1012
+ // 尝试最后一次获取缓存作为保底
1013
+ try {
1014
+ Location loc = locationManager.getLastKnownLocation(provider);
1015
+ if (loc != null) {
1016
+ promise.resolve(locationToMap(loc));
1017
+ } else {
1018
+ Log.w("BeiDouBluetoothModule", "定位超时,未获取到位置");
1019
+ promise.resolve(null);
1020
+ }
1021
+ } catch (Exception e) {
1022
+ promise.resolve(null);
1023
+ }
1024
+ }
1025
+ }
1026
+ }, 10000); // 10秒超时
1027
+
1028
+ } catch (SecurityException e) {
1029
+ if (isHandled.compareAndSet(false, true)) {
1030
+ promise.reject("PERMISSION_ERROR", e.getMessage());
1031
+ }
1032
+ }
1033
+ }
1034
+
925
1035
  // ================== 日志管理相关方法 ==================
926
1036
 
927
1037
  /**
@@ -73,8 +73,16 @@ public class BeidouAidlHelper {
73
73
  if (beidouService != null) {
74
74
  try {
75
75
  beidouService.setCallback(beidouServiceCallback);
76
+ if (beidouServicePromise != null) {
77
+ beidouServicePromise.resolve(true);
78
+ beidouServicePromise = null;
79
+ }
76
80
  } catch (Exception e) {
77
81
  Log.e("BeiDouService", "设置北斗服务回调失败: " + e.getMessage(), e);
82
+ if (beidouServicePromise != null) {
83
+ beidouServicePromise.reject("BIND_ERROR", "绑定北斗服务失败: " + e.getMessage(), e);
84
+ beidouServicePromise = null;
85
+ }
78
86
  }
79
87
  }
80
88
  }
@@ -91,16 +99,16 @@ public class BeidouAidlHelper {
91
99
  public BeidouAidlHelper(@Nullable ReactApplicationContext reactContext) {
92
100
  this.reactContext = reactContext;
93
101
  }
94
-
102
+ private Promise beidouServicePromise;
95
103
  public void bindService(String packageName, String actionName, Promise promise) {
96
104
  if (reactContext == null) {
97
105
  promise.reject("CONTEXT_NULL", "React上下文不可用");
98
106
  return;
99
107
  }
100
-
101
108
  try {
109
+ beidouServicePromise = promise;
102
110
  bindBeidouService(packageName, actionName);
103
- promise.resolve(true);
111
+ // promise.resolve(true);
104
112
  } catch (Exception e) {
105
113
  promise.reject("BIND_ERROR", "绑定北斗服务失败: " + e.getMessage(), e);
106
114
  }
@@ -4,9 +4,13 @@
4
4
  <dict>
5
5
  <key>files</key>
6
6
  <dict>
7
+ <key>.DS_Store</key>
8
+ <data>
9
+ 7xO+IM9LM37K4Eu6kj0XuMkeOA4=
10
+ </data>
7
11
  <key>FMDB.bundle/Info.plist</key>
8
12
  <data>
9
- fQm/OgDmwDzxKX8rvFINy7CJkJ4=
13
+ YbOcdNhJc+cRHTTiKtlpFGTYrkk=
10
14
  </data>
11
15
  <key>FMDB.bundle/PrivacyInfo.xcprivacy</key>
12
16
  <data>
@@ -34,7 +38,7 @@
34
38
  </data>
35
39
  <key>Info.plist</key>
36
40
  <data>
37
- XA4b0GI82DRY0I4G277GU6YcIDc=
41
+ niEQ4R1NMt9znoOfKZHqo3IsMQY=
38
42
  </data>
39
43
  <key>Modules/module.modulemap</key>
40
44
  <data>
@@ -45,21 +49,13 @@
45
49
  <dict>
46
50
  <key>FMDB.bundle/Info.plist</key>
47
51
  <dict>
48
- <key>hash</key>
49
- <data>
50
- fQm/OgDmwDzxKX8rvFINy7CJkJ4=
51
- </data>
52
52
  <key>hash2</key>
53
53
  <data>
54
- BeV82aZzyEQ+5IJExHzOKtyngMdCpF/kTedm1V+R9cA=
54
+ rZml5/t9RGeZsbAX3DM4md4BS3w4qjEEztuz895nu+8=
55
55
  </data>
56
56
  </dict>
57
57
  <key>FMDB.bundle/PrivacyInfo.xcprivacy</key>
58
58
  <dict>
59
- <key>hash</key>
60
- <data>
61
- ucg9pita0v8d353x3NuGfxweQYU=
62
- </data>
63
59
  <key>hash2</key>
64
60
  <data>
65
61
  Uh6274Qwdz5cAQ4YOP6d2PpdYre3bRzqjX2NqtyxROI=
@@ -67,10 +63,6 @@
67
63
  </dict>
68
64
  <key>Headers/BDTBluetoothManager.h</key>
69
65
  <dict>
70
- <key>hash</key>
71
- <data>
72
- Mke3zeUQy40YfFrfW2gJ82VfWV4=
73
- </data>
74
66
  <key>hash2</key>
75
67
  <data>
76
68
  za/DfAgrjgS1qm3F78y6hNJPqscxWzIx+vD7ol+wERA=
@@ -78,10 +70,6 @@
78
70
  </dict>
79
71
  <key>Headers/BDTChatDBManager.h</key>
80
72
  <dict>
81
- <key>hash</key>
82
- <data>
83
- Ssm2BaxSbw5TyDQFFEvzaAIzti0=
84
- </data>
85
73
  <key>hash2</key>
86
74
  <data>
87
75
  TFMm6gfl9wRQMpzzFN3/sm1qAREjTDYKKfkUREEoOM8=
@@ -89,10 +77,6 @@
89
77
  </dict>
90
78
  <key>Headers/BDTDataPacketBuilder.h</key>
91
79
  <dict>
92
- <key>hash</key>
93
- <data>
94
- M2mub8VwH6cd3mT+Cmj6jU/wxfs=
95
- </data>
96
80
  <key>hash2</key>
97
81
  <data>
98
82
  HDzbJwP03m263UzurGCq5CnM2RmRkmJAvzRPsKAmZ9U=
@@ -100,10 +84,6 @@
100
84
  </dict>
101
85
  <key>Headers/BDTLocationService.h</key>
102
86
  <dict>
103
- <key>hash</key>
104
- <data>
105
- RzN/dKza3l/TAtgAS9ZuWVtxszs=
106
- </data>
107
87
  <key>hash2</key>
108
88
  <data>
109
89
  H3MgmiqqbNExoGreVNN3gPO81RCdL/r1NmAFF12PG4c=
@@ -111,10 +91,6 @@
111
91
  </dict>
112
92
  <key>Headers/BeidouBluetooth.h</key>
113
93
  <dict>
114
- <key>hash</key>
115
- <data>
116
- pjIaMEI7NmkpW/V7pIaOIcpW/8E=
117
- </data>
118
94
  <key>hash2</key>
119
95
  <data>
120
96
  7B/Mf1b1ApHkKh4ojqs364EJalW6lo6L8V3Bmv1gnvs=
@@ -122,10 +98,6 @@
122
98
  </dict>
123
99
  <key>Modules/module.modulemap</key>
124
100
  <dict>
125
- <key>hash</key>
126
- <data>
127
- yHOK7zkIIc74zmi9L/LHK2NDXUY=
128
- </data>
129
101
  <key>hash2</key>
130
102
  <data>
131
103
  2jYuzibwQKK2r2a2CS68WaFxOT/Tk941Kc8LUBwRUcg=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-beidou",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "A React Native module for BeiDou Bluetooth communication.",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = "react-native-beidou"
3
- s.version = "1.1.2" # 与 package.json 中的版本保持一致
3
+ s.version = "1.1.3" # 与 package.json 中的版本保持一致
4
4
  s.summary = "React Native Beidou Module"
5
5
  s.description = <<-DESC
6
6
  A React Native module for Beidou functionality.
@@ -5,7 +5,10 @@ module.exports = {
5
5
  sourceDir: "./android",
6
6
  packageImportPath: "import com.fxzs.rnbeidou.BeiDouBluetoothPackage;",
7
7
  packageInstance: "new com.fxzs.rnbeidou.BeiDouBluetoothPackage()"
8
- }
9
- }
8
+ },
9
+ ios: {
10
+ // 显式指定 podspec 路径 (可选,通常不需要,但为了排错可以加上)
11
+ podspecPath: "./react-native-beidou.podspec",
12
+ } }
10
13
  }
11
14
  };