Skip to content

Commit 94eb427

Browse files
committed
#45 fixed
1 parent 3cf0bd0 commit 94eb427

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ To stop scanning call:
177177
scanner.stopScan(context, pendingIntent);
178178
```
179179

180+
**Note:** Android versions 6 and 7 will not report any advertising packets when in Doze mode.
181+
Read more about it here: https://developer.android.com/training/monitoring-device-state/doze-standby
182+
180183
## Background scanning guidelines
181184

182185
To save power it is recommended to use as low power settings as possible and and use filters.

scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScannerService.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,15 @@ public IBinder onBind(final Intent intent) {
9595
@Override
9696
public void onTaskRemoved(final Intent rootIntent) {
9797
super.onTaskRemoved(rootIntent);
98-
stopSelf();
98+
// Stopping self here would cause the service to be killed when user removes the task
99+
// from Recents. This is not the behavior found in Oreo+.
100+
// Related issue: https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/issues/45
101+
102+
// Even with this line removed, the service will stop receiving devices when the phone
103+
// enters Doze mode.
104+
// Find out more here: https://developer.android.com/training/monitoring-device-state/doze-standby
105+
106+
// stopSelf();
99107
}
100108

101109
@Override

0 commit comments

Comments
 (0)