From 755b28e32534d75a6f8079b9be5a8e1b81aef636 Mon Sep 17 00:00:00 2001 From: Sawyer Schumacher Date: Fri, 4 Nov 2022 14:43:28 -0600 Subject: [PATCH] feat(ble): add wrapper for starting location notifications (#4399) --- .../plugins/ble/index.ts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/@awesome-cordova-plugins/plugins/ble/index.ts b/src/@awesome-cordova-plugins/plugins/ble/index.ts index 4c47232ad..6ec27e78d 100644 --- a/src/@awesome-cordova-plugins/plugins/ble/index.ts +++ b/src/@awesome-cordova-plugins/plugins/ble/index.ts @@ -564,6 +564,37 @@ export class BLE extends AwesomeCordovaNativePlugin { return; } + /** + * Registers to be notified when Location service state changes on the device. + * + * @usage + * ``` + * ble.startLocationStateNotifications(success, failure); + * // Or using await with promises + * // Note, initial promise resolves or rejects depending on whether the subscribe was successful + * await ble.withPromises.startLocationStateNotifications(success, failure) + * ``` + * @returns {Observable} Returns an Observable that notifies when Location is enabled or disabled on the device. + */ + @Cordova({ + observable: true, + clearFunction: 'stopLocationStateNotifications', + clearWithArgs: false, + }) + startLocationStateNotifications(): Observable { + return; + } + + /** + * Stop location state notifications. + * + * @returns {Promise} + */ + @Cordova() + stopLocationStateNotifications(): Promise { + return; + } + /** * Open System Bluetooth settings (Android only). *