Skip to content

Commit

Permalink
Merge pull request #828 from AltBeacon/fix-crash-on-starting-foregrou…
Browse files Browse the repository at this point in the history
…nd-service

Fix crash on scanning as foreground service
  • Loading branch information
davidgyoung authored Feb 10, 2019
2 parents 091d499 + 411d058 commit 9f5a6a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit 9f5a6a6

Please sign in to comment.