Join GitHub today
Dealing with Doze and Standby in Android Marshmallow #413
NOTE: We have tested this manually on the only Marshmallow devices we have but we need to test on more devices and we need to upgrade CI so that it has a new version of ADB build for our ARM environment on the Raspberry PIs that will allow us to automatically grant permissions.
When an App is put into Doze or Standby mode in Marshmallow it isn't allowed to connect to the network or to run or do anything. Now it's unclear what this means if one is trying to do things like run a BLE scanner or BLE beacon in the background. Also there is a special permission that the user has to approve in order to get around these restrictions.
We need answers to the following questions:
How does Doze and Standby affect services? Do they only apply to the app's foreground or to its services as well?
If Doze and Standby affect services then we need to know:
While our app is in Doze or Standby mode can we still be a BLE beacon?
If the answer to the two questions above is yes then we need to figure out if receiving an incoming BLE connection or discovering a remote BLE beacon will give us the ability to wake out of Doze/Standby and establish a BLE transfer and then establish a Bluetooth connection?
Separately we also need to figure out what we can do about WiFi. If local WiFi supports multicasting and direct connections then we will want to regularly ping the local AP (if there is one) to see if there is anyone around who wants to exchange information. It sounds like all WiFi gets turned off, so what can do we to make it go on?
Maybe we can do what we already are doing? If not then we have to investigate the feature they added to get white listed as an application that is exempted from Doze and Standby. Exempted apps still have limitations so we have to figure out if our BLE and Bluetooth functionality will continue to work right under those exemptions.
referenced this issue
Mar 4, 2016
Tested with Nexus 6 (Android version 6.0.1).
How to reproduce the test scenario:
private static final String SERVICE_UUID_AS_STRING = "b6a44ad1-d319-4b3a-815d-8b805a47fb51"; //"fa87c0d0-afac-11de-8a39-0800200c9a66"; private static final String BLE_SERVICE_UUID_AS_STRING = "b6a44ad1-d319-4b3a-815d-8b805a47fb51";