react-native-ble-manager 11.3.2 → 11.4.0
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/android/build.gradle
CHANGED
|
@@ -25,7 +25,7 @@ android {
|
|
|
25
25
|
namespace "it.innove"
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
compileSdk safeExtGet("compileSdk",
|
|
28
|
+
compileSdk safeExtGet("compileSdk", 34)
|
|
29
29
|
|
|
30
30
|
compileOptions {
|
|
31
31
|
sourceCompatibility JavaVersion.VERSION_1_9
|
|
@@ -34,7 +34,7 @@ android {
|
|
|
34
34
|
|
|
35
35
|
defaultConfig {
|
|
36
36
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
37
|
-
targetSdk safeExtGet("targetSdk",
|
|
37
|
+
targetSdk safeExtGet("targetSdk", 34)
|
|
38
38
|
}
|
|
39
39
|
lintOptions {
|
|
40
40
|
abortOnError false
|
|
@@ -3,6 +3,7 @@ package it.innove;
|
|
|
3
3
|
import static android.app.Activity.RESULT_OK;
|
|
4
4
|
import static android.bluetooth.BluetoothProfile.GATT;
|
|
5
5
|
import static android.os.Build.VERSION_CODES.LOLLIPOP;
|
|
6
|
+
import static android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE;
|
|
6
7
|
|
|
7
8
|
import android.annotation.SuppressLint;
|
|
8
9
|
import android.app.Activity;
|
|
@@ -153,10 +154,18 @@ class BleManager extends ReactContextBaseJavaModule {
|
|
|
153
154
|
|
|
154
155
|
IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
|
|
155
156
|
filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
|
|
156
|
-
context.registerReceiver(mReceiver, filter);
|
|
157
157
|
IntentFilter intentFilter = new IntentFilter(BluetoothDevice.ACTION_PAIRING_REQUEST);
|
|
158
158
|
intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
|
159
|
-
|
|
159
|
+
if (Build.VERSION.SDK_INT >= UPSIDE_DOWN_CAKE){
|
|
160
|
+
// Google in 2023 decides that flag RECEIVER_NOT_EXPORTED or RECEIVER_EXPORTED should be explicit set SDK 34(UPSIDE_DOWN_CAKE) on registering receivers.
|
|
161
|
+
// Also the export flags are available on Android 8 and higher, should be used with caution so that don't break compability with that devices.
|
|
162
|
+
context.registerReceiver(mReceiver, filter, Context.RECEIVER_NOT_EXPORTED);
|
|
163
|
+
context.registerReceiver(mReceiver, intentFilter, Context.RECEIVER_NOT_EXPORTED);
|
|
164
|
+
} else {
|
|
165
|
+
context.registerReceiver(mReceiver, filter);
|
|
166
|
+
context.registerReceiver(mReceiver, intentFilter);
|
|
167
|
+
}
|
|
168
|
+
|
|
160
169
|
callback.invoke();
|
|
161
170
|
Log.d(LOG_TAG, "BleManager initialized");
|
|
162
171
|
}
|
|
@@ -181,9 +190,9 @@ class BleManager extends ReactContextBaseJavaModule {
|
|
|
181
190
|
}catch(Exception e){
|
|
182
191
|
callback.invoke("Current activity not available");
|
|
183
192
|
}
|
|
184
|
-
|
|
193
|
+
|
|
185
194
|
}
|
|
186
|
-
|
|
195
|
+
|
|
187
196
|
} else
|
|
188
197
|
callback.invoke();
|
|
189
198
|
}
|
package/ios/Helper.swift
CHANGED
|
@@ -268,7 +268,7 @@ class Peripheral:Hashable {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
func servicesInfo() -> Dictionary<String, Any> {
|
|
271
|
-
var servicesInfo: [String: Any] =
|
|
271
|
+
var servicesInfo: [String: Any] = advertisingInfo()
|
|
272
272
|
|
|
273
273
|
var serviceList = [[String: Any]]()
|
|
274
274
|
var characteristicList = [[String: Any]]()
|