Skip to content
Open

Shah #476

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,23 @@
target-dir="src/com/megster/cordova"/>

<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- Android <= 11 -->
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<!-- <uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="30" /> -->
<!-- Android 12+ -->
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
<uses-permission
android:name="android.permission.BLUETOOTH_CONNECT" />
</config-file>

</platform>

<platform name="ios">
Expand All @@ -44,6 +56,16 @@
<param name="ios-package" value="MEGBluetoothSerial" onload="true"/>
</feature>
</config-file>

<config-file target="*-Info.plist"
parent="NSBluetoothAlwaysUsageDescription">
<string>This app uses Bluetooth to connect to the thermal printer.</string>
</config-file>

<config-file target="*-Info.plist"
parent="NSBluetoothPeripheralUsageDescription">
<string>This app uses Bluetooth to connect to the thermal printer.</string>
</config-file>

<header-file src="src/ios/MEGBluetoothSerial.h" target-dir="BluetoothSerial" />
<source-file src="src/ios/MEGBluetoothSerial.m" target-dir="BluetoothSerial" />
Expand Down
2 changes: 1 addition & 1 deletion src/ios/BLE.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ - (int) findBLEPeripherals:(int) timeout
hc02AdvUUID = [CBUUID UUIDWithString:@HC02_ADV_UUID];
NSArray *services = @[redBearLabsServiceUUID, adafruitServiceUUID, lairdServiceUUID, blueGigaServiceUUID, hm10ServiceUUID,
hc02AdvUUID];
[self.CM scanForPeripheralsWithServices:services options: nil];
[self.CM scanForPeripheralsWithServices:nil options: nil];
#else
[self.CM scanForPeripheralsWithServices:nil options:nil]; // Start scanning
#endif
Expand Down