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

Cannot stop advertising #14

Open
bauyrzhanospan opened this issue Apr 5, 2019 · 2 comments
Open

Cannot stop advertising #14

bauyrzhanospan opened this issue Apr 5, 2019 · 2 comments

Comments

@bauyrzhanospan
Copy link

Cannot stop advertising, there is no method (function) stopAdvertising.
2019-04-05 16:30:31.783177+0600 BuyQaw[908:171290] exception nativeEvalAndFetch : TypeError: blePeripheral.stopAdvertising is not a function. (In 'blePeripheral.stopAdvertising(SERVICE_UUID, 'BuyQaw')', 'blePeripheral.stopAdvertising' is undefined)

@stargurl16
Copy link

stargurl16 commented May 11, 2019

you have to create your own method.

Adding this to your BLEPeripheralPlugin.m file should set you off in the right direction:

- (void)stopAdvertising:(CDVInvokedUrlCommand *)command {
    [manager stopAdvertising];
    
}

You'll also need to add the function to the blePeripheral.js file

stopAdvertising: function(resolve, reject) { cordova.exec(resolve, reject, "BLEPeripheral", "stopAdvertising"); },

hope that helps

@DalterioRaffaele
Copy link

DalterioRaffaele commented Jun 6, 2022

Adding in file blePeripheral

stopAdvertising: function(resolve, reject) { cordova.exec(resolve, reject, "BLEPeripheral", "stopAdvertising"); },      
blePeripheral.stopAdvertising().then(
    (res) => { console.log("result", res) })
    .catch(err => {
      console.log("stopAdvertising  Error: ", err);
    });   

I always have this error. stopAdvertising Error: Invalid action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants