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

Fix crash on scanning as foreground service #828

Merged
merged 3 commits into from
Feb 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### Development

- Fix crash on starting scanning with a forground service configured when multiple BeaconConsumer
instances bound. (#828, David G. Young)
- Fix broken RegionBoostrap callbacks caused by change in previous release (#829, David G. Young)

### 2.16 / 2019-02-10
Expand Down
10 changes: 8 additions & 2 deletions lib/src/main/java/org/altbeacon/beacon/BeaconManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,14 @@ public void bind(@NonNull BeaconConsumer consumer) {
Intent intent = new Intent(consumer.getApplicationContext(), BeaconService.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
this.getForegroundServiceNotification() != null) {
LogManager.i(TAG, "Starting foreground beacon scanning service.");
mContext.startForegroundService(intent);
if (isAnyConsumerBound()) {
LogManager.i(TAG, "Not starting foreground beacon scanning" +
" service. A consumer is already bound, so it should be started");
}
else {
LogManager.i(TAG, "Starting foreground beacon scanning service.");
mContext.startForegroundService(intent);
}
}
else {
}
Expand Down