The Pixel 2 has a handy feature that allows the phone to turn on Do Not Disturb when it detects its user is driving a car. The trick is enabled by a tool called the Transition API, which uses algorithms to recognize different types of real-world activity. Google announced Tuesday that the Transition API is now available for use by all Android developers.
Previous methods of determining activity like driving relied on more complicated methods that provided less accurate results—Intuit, which partnered with Google to test the Transition API in its QuickBooks Self-Employed app, says that before the new API, it used "GPS, phone sensors, and other metadata" to determine whether its users were driving, and some trips weren't detected at all. The Transition API offers "a more reliable solution that also reduced [their] battery consumption."
A developer guide is available now for the Transition API. The guide specifically mentions detecting activities like walking, biking, or driving. Google says it's continuing development on the API, and more features—like being able to tell the difference between driving and taking a train—are on the way.
- Android Developers Blog