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

isAdvertising() always return false in Android? #439

Open
kctang opened this issue Mar 23, 2020 · 3 comments
Open

isAdvertising() always return false in Android? #439

kctang opened this issue Mar 23, 2020 · 3 comments

Comments

@kctang
Copy link

kctang commented Mar 23, 2020

Based on what I read, advertising beacon is supported on Android (Lollipop and up).

However, this call seems to always return false.

PluginResult result = new PluginResult(PluginResult.Status.OK, false);

Note: I am looking into the Android source because cannot get the advertised beacon on Android device detected. Advertising seems to be succesful.

Logcat output:

V/Capacitor/Plugin: To native (Cordova plugin): callbackId: LocationManager257369777, service: LocationManager, action: isAdvertising, actionArgs: []
I/BeaconTransmitter: Advertisement start succeeded.
W/com.unarin.beacon: startAdvertising start succeeded.

I am still in the midst of figuring this out. Any help on this would be appreciated. Thanks!

@kodeine
Copy link

kodeine commented Mar 23, 2020

Can you share the code to start advertisement? for me it always says false also await this.ibeacon.isAdvertising(), is coming as false as well even though i started advertising

@kctang
Copy link
Author

kctang commented Mar 23, 2020

I start advertising with this:

await this.ibeacon.startAdvertising(this.ibeacon.BeaconRegion('myBeacon', '00000000-0000-0000-0000-000000000000', 10, 10, true))

The promise completes successfully (i.e. the logcat output in my first post).

However, calling isAdvertising() after startAdvertising() returns false.

    const checkB = await this.ibeacon.isAdvertising()
    this.log(`isAdvertising is ${checkB}`)

I believe the cordova plugin will call the LocationManager.java code snippet I highlighted above - which always returns false.

I suspect isAdvertising() does not really reflect if advertising has started on Android as it always return false.

@oscarviq
Copy link

oscarviq commented Apr 5, 2020

Having this same issue in an Ionic Application, checking .isAdvertising() always returns false

Also even though .startAdvertising() does not bring up any errors the delegate events for .peripheralManagerDidStartAdvertising() are never triggered

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