Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Android 13, added "fineLocation" option #460

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Bluetooth Serial Plugin for PhoneGap

This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino.
This plugin enables serial communication over Bluetooth. The original one was written for communicating between Android or iOS and an Arduino. This fork is meant to be able to connect and operate to a Bluetooth Printer

Android and Windows Phone use Classic Bluetooth. iOS uses Bluetooth Low Energy.
Android Classic Bluetooth. iOS uses Bluetooth Low Energy.

## Supported Platforms

* Android
* Android with [Mini Thermal Printer POS-5809DD](https://www.amazon.com/Fesjoy-Portable-Wireless-Rechargeable-Plug%EF%BC%88100-240V%EF%BC%89/dp/B094QW8QCQ)
* iOS with [RedBearLab](http://redbearlab.com) BLE hardware, [Adafruit Bluefruit LE](http://www.adafruit.com/products/1697), [Laird BL600](http://www.lairdtech.com/Products/Embedded-Wireless-Solutions/Bluetooth-Radio-Modules/BL600-Series/#.VBI7AS5dUzI), [BlueGiga](https://bluegiga.zendesk.com/entries/29185293--BGScript-spp-over-ble-AT-command-SPP-implementation-for-BLE), or [HC-02](http://www.hc01.com/productdetail?productid=20180314021)
* Windows Phone 8
* Browser (Testing only. See [comments](https://github.com/don/BluetoothSerial/blob/master/src/browser/bluetoothSerial.js).)

[Supporting other Bluetooth Low Energy hardware](#supporting-other-ble-hardware)
Expand All @@ -26,11 +25,11 @@ Install with Cordova cli

$ cordova plugin add cordova-plugin-bluetooth-serial

Note that this plugin's id changed from `com.megster.cordova.bluetoothserial` to `cordova-plugin-bluetooth-serial` as part of the migration from the [Cordova plugin repo](http://plugins.cordova.io/) to [npm](https://www.npmjs.com/).
Note that this plugin's id changed from `com.megster.cordova.bluetoothserial` to `cordova-plugin-bluetooth-serial` and then to `cordova-plugin-bluetooth-serial-2` as part of the migration from the [Cordova plugin repo](http://plugins.cordova.io/) to [npm](https://www.npmjs.com/). Then it was change to be able to install the new version via npm.

# Examples

There are some [sample projects](https://github.com/don/BluetoothSerial/tree/master/examples) included with the plugin.
There are some [sample projects](https://github.com/giuseppelanzi/BluetoothSerial/tree/master/examples) included with the plugin.

# API

Expand Down Expand Up @@ -535,7 +534,7 @@ If `enable` is called when Bluetooth is already enabled, the user will not promp

Discover unpaired devices

bluetoothSerial.discoverUnpaired(success, failure);
bluetoothSerial.discoverUnpaired(fineLocation, success, failure);

### Description

Expand Down Expand Up @@ -572,6 +571,7 @@ Calling `connect` on an unpaired Bluetooth device should begin the Android pairi

### Parameters

- __fineLocation__: True to enable fine geolocalization, set it as true only if you need to determine the physical position of the bluetooth devices. [optional]
- __success__: Success callback function that is invoked with a list of unpaired devices.
- __failure__: Error callback function, invoked when error occurs. [optional]

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-bluetooth-serial",
"version": "0.4.7",
"version": "0.4.8",
"description": "Bluetooth Serial Communication Plugin",
"main": "./www/bluetoothSerial.js",
"cordova": {
Expand Down
11 changes: 9 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@
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.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-feature android:name="android.hardware.bluetooth" android:required="true"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<!-- Needed only if your app uses Bluetooth scan results to derive physical location. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</config-file>

Expand Down
Loading