MEGHAN DESAI: Developers using Bluetooth Low
Energy have a tough time today.
The stability is inconsistent, and it
burns through the battery, which ultimately
leads to your users are unhappy with your app.
The good news is that at Android l we're fixing this.
My name is Meghan.
I'm a product manager on the Android team,
and I'm here to tell you about two key improvements,
peripheral mode and improved scanning.
Bluetooth Low Energy is a low-power form
of Bluetooth communications.
It allows devices like your Android phones and tablets
to communicate with peripherals like fitness bands,
or Bluetooth beacons.
Your Android phone in central mode
can scan for advertisement broadcast from peripherals,
and it can also form connections to exchange additional data.
Bluetooth Low Energy scans first landed in Android 4.3,
and one of the biggest drawbacks was
that scanning prevents a device from going into standby.
If your app needs to scan frequently or constantly,
say for nearby Bluetooth beacons,
preventing your user's devices from going into standby
will kill their battery.
And trust me, no one likes an app that drains their battery.
In order to address this problem,
we have offloaded scanning to the background in a way that
allows the device to enter into standby when it isn't detecting
advertisements from nearby devices.
But at any given part of your user's day,
their device may be bombarded with advertisement packets
from the myriad of devices in their vicinity.
This would still prevent the device from entering standby.
To address that, we've added new APIs
that make your scanning even more efficient.
These APIs allow you to specify filters
to reduce the number of potential advertisement packets
your application needs to process.
You can set filters on specific parts
of the packet like service UUID, service data, and manufacturer
data.
With these filters in place, your user's device
but only makeup on standby and tell your app
when it finds a packet matching your filters.
You only get notified if an Android finds
a nearby device you're really interested in.
Your user's device will keep scanning in the background
indefinitely until you stop the scan manually.
But your user's device may also be connected to other devices,
like a Bluetooth headset.
Starting in the L release, Android
will optimize and balance scanning with other activities
and power based on your request.
You can request to have Android scan with low latency.
This will increase how quickly you
detect a device you are interested in when
it comes within range.
But even background scanning consumes power,
and scanning more frequently will consume more power.
If detecting the other device is not time critical,
like when the phone is in standby in the user's pocket,
you can ask Android to scan less frequently and save power.
We've added peripheral mode too.
An Android device can now act as a Bluetooth Low Energy
peripheral.
It can broadcast advertisement packets
and form data connections with other BLE devices.
In fact, your apps can specify the contents of the broadcast
packet like service UUID, service data, and manufacturer
data.
This allows your app to produce more meaningful advertisement
packets for your use case.
But the space in an advertisement package
is limited if another app has already filled it up,
then there's no space for your app's packet contents.
To fix this problem, Android now allows multiple apps
to advertise concurrently, allowing
each app its own packet.
If your app needs to advertise more frequently
to enable other devices to detect it quicker,
you can request low latency.
Of course, advertising more frequently
will consume more power.
If your use case allows advertising less frequently,
you can request low power.
Just like with scanning, Android will
optimize how often to transmit your advertisement
packets, balancing power and other demands on Bluetooth,
such as scanning or a Bluetooth audio connection.
Now, try out our improved scanning a peripheral mode
support for yourself.
Thanks for watching.