AndroidBuildProvider

Interface for providing Android Build properties in a testable way.

This abstraction allows for easier unit testing by enabling dependency injection of Build property access rather than directly accessing static Build fields. It provides access to key device identification properties from Build class.

Testing Benefits:

  • Enables mocking of Build properties during unit tests

  • Allows testing with different device configurations

  • Prevents tests from being dependent on actual device properties

Usage:

class MyCollector(private val buildProvider: AndroidBuildProvider = DefaultAndroidBuildProvider()) {
fun getDeviceInfo() = buildProvider.getHardware()
}

See also

for the production implementation

for the underlying Android Build class

Inheritors

Functions

Link copied to clipboard
open fun getDevice(): String?

Returns the device identifier.

Link copied to clipboard
open fun getHardware(): String?

Returns the hardware identifier string.

Link copied to clipboard
open fun getManufacturer(): String?

Returns the device manufacturer name.