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

No beacons detected when ranging and phone locked Android #141

Open
27comar opened this issue Jul 5, 2019 · 10 comments
Open

No beacons detected when ranging and phone locked Android #141

27comar opened this issue Jul 5, 2019 · 10 comments

Comments

@27comar
Copy link

27comar commented Jul 5, 2019

Version

1.0.7

Platform

Android

OS version

Android 8.1.0

Steps to reproduce

  1. Start beacon ranging
  2. Lock the device

Expected behavior

The beacons around should be visible in the array of the 'beaconsDidRange' event, like when the app is in foreground.

Actual behavior

The 'beaconsDidRange' event is triggered each second, but the array of beacons around is empty.

When the app is in foreground or background but the phone is unlocked, the ranging works correctly. The only problem is when the phone is locked. I only have access to a 8.1.0 Android device, so I couldn't test with other versions.

@divye11
Copy link

divye11 commented Jul 30, 2019

I suppose Android Oreo has put forth execution limits in the background, as well as when the app is killed. In order to continuously(regardless of the state) detect beacons, you need a foreground service. Which device are you using? Share the logs from Android Studio, that could show when detection was stopped.

@chentianci123
Copy link

我遇到了同样的问题,请问您解决了吗

@sfreeman28
Copy link

@27comar Hey did you get any further with this issue?
I am witnessing the same thing on my Android phone.

I don't see any foreground service being managed in the library's android code.

@chentianci123
Copy link

@27comar Hey did you get any further with this issue?
I am witnessing the same thing on my Android phone.

I don't see any foreground service being managed in the library's android code.

I encountered the same problem before, you try to modify the version of react-native

@sfreeman28
Copy link

@chentianci123 I am using version 0.59.10 of react-native

@chentianci123
Copy link

@chentianci123 I am using version 0.59.10 of react-native

You changed the react-native version of react-native-beacons-manager to be the same as your version, or integrated the source code of this plugin directly into your existing project

@27comar
Copy link
Author

27comar commented Jun 3, 2020

@sfreeman28 @chentianci123 I'm really sorry, I wasn't active on my GitHub account until now.
I was able to resolve the problem by changing the dependency of the beacon library that is used by this library. I will explain in case you still need it.

In fact, in the react-native-beacons-manager/android/build.gradle file, I replaced the line 32 (at the time of my project it was line 32, maybe it has changed) with :
compile 'org.altbeacon:android-beacon-library:2.13.1' (I think it must be equal or greater than 2.13.1, at the time I used it in August 2019 it worked with 2.13.1).

Hope this helps :)

@sfreeman28
Copy link

Thank you @27comar! Yes this solves the issue, thanks for the reply =]

@sfreeman28
Copy link

Hi @27comar was just wondering if you also encountered issues with iOS in your app?
My issue is described here #189.

I know it's not on Android but its similar in that both issues are related to backgrounding the application. Thanks

@27comar
Copy link
Author

27comar commented Jun 5, 2020

Hi @27comar was just wondering if you also encountered issues with iOS in your app?
My issue is described here #189.

I know it's not on Android but its similar in that both issues are related to backgrounding the application. Thanks

Hi @sfreeman28, I'm happy I could help you !
I also encountered your problem on iOS and answered to you in your other issue, here. Hope this helps too !

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

4 participants