Class POBDeviceInfo

  • All Implemented Interfaces:

    
    public class POBDeviceInfo
    
                        

    A class representing the Device details, derived internally using framework APIs.

    Values such as disk free space, battery, audio routes, DND, and brightness are read from the system on each get* call so bid requests reflect the latest state. Keyboard input languages are captured once when this object is constructed. System reads are implemented in the package-private POBDeviceInfoReader helper.

    • Constructor Detail

      • POBDeviceInfo

        POBDeviceInfo(Context context)
        Constructor.
        Parameters:
        context - context
    • Method Detail

      • getTimeZoneOffsetInMinutes

         int getTimeZoneOffsetInMinutes()

        Return local time as the number +/- of minutes from UTC. To be sent as 'utcoffset' in oRTB. Example: +330 for IST i.e. UTC+5:30

        Returns:

        Local time offset

      • getBootTimeMs

         long getBootTimeMs()

        Kernel boot wall-clock timestamp in milliseconds since Unix epoch (best-effort). Derived from System.currentTimeMillis() - SystemClock.elapsedRealtime().

        Returns:

        estimated boot instant in UTC ms, or DEVICE_EXT_UNKNOWN_LONG if not usable

      • getTotalDiskSpaceMb

         double getTotalDiskSpaceMb()

        Total primary storage capacity of the device (the total typically shown in system storage settings, e.g. 128 GB), expressed in decimal megabytes (1 MB = 1_000_000 bytes). Extension-style: device.ext.totaldisk. Rounded to two decimal places (HALF_UP) at construction time.

        Returns:

        non-negative MB (two fractional digits), or DEVICE_EXT_UNKNOWN_DOUBLE if unavailable

      • getInputLanguages

        @NonNull() Array<String> getInputLanguages()

        Languages configured on enabled keyboard input methods (IME subtype language tags / locales). Order is stable; duplicates removed. Collected once at construction.

        Returns:

        input language array

      • getPpi

         int getPpi()

        Approximate device PPI index from display metrics (rounded average of xdpi and ydpi).

        Returns:

        non-negative PPI estimate, or 0 if unavailable

      • refreshAdvertisingIdInfo

         void refreshAdvertisingIdInfo()

        Method is used to update advertising Id from AdvertisingIdClient class

      • getISOAlpha2CountryCode

        @Nullable() String getISOAlpha2CountryCode()

        Returns the ISO-3166-1 alpha-2 country code if available

        Returns:

        The lowercase 2 character ISO-3166-1 alpha-2 country code, object if not available

      • getISOAlpha3CountryCode

        @Nullable() String getISOAlpha3CountryCode()

        Returns the ISO-3166-1 alpha-3 country code if available. Priority is from TelephonyManager followed by GPS system.

        Returns:

        The lowercase 3 character ISO-3166-1 alpha-3 country code, object if not available

      • getUserAgent

        @WorkerThread() String getUserAgent()

        This method fetch the user agent from WebSettings and save it for future reference. And return the same. If not found then just return user-agent using System.getProperty("http.agent"). It will return empty string in case unable to fetch the user-agent at all.

        Returns:

        user agent

      • getCurrentTime

         String getCurrentTime()

        Method is used to get current datetime in formated String yyyy-MM-dd HH:mm:ss

        Returns:

        return date of type String

      • getDiskSpaceMb

         double getDiskSpaceMb()

        Available disk space on the internal data partition, in binary megabytes (MiB). Read from the system on each call (free space changes over time). Values are rounded to two decimal places (HALF_UP) for alignment with device.ext.diskspace.

        Returns:

        non-negative MiB (two fractional digits), or DEVICE_EXT_UNKNOWN_DOUBLE if unavailable

      • getCharging

         int getCharging()

        Whether external power (charger / USB / wireless) appears connected. Read from the system on each call.

        Returns:

        1 if EXTRA_PLUGGED is non-zero, 0 if not charging, or DEVICE_EXT_UNKNOWN_INT if the state could not be read

      • getBatteryLevel

         double getBatteryLevel()

        Remaining battery charge as a fraction of full capacity. Read from the system on each call; when known, rounded to two decimal places (HALF_UP) in [0.0, 1.0] for alignment with device.ext.batterylevel. Returned as double (not float) so JSON encoding avoids float round-trip noise.

        Returns:

        value in [0.0, 1.0] when known, or DEVICE_EXT_UNKNOWN_DOUBLE if unknown

      • getRingMute

         int getRingMute()

        Whether ring / alert sounds are effectively muted. Read from the system on each call.

        Returns:

        1 if silent/vibrate profile or ring stream muted (API 23+), 0 otherwise, or DEVICE_EXT_UNKNOWN_INT if unavailable

      • getBluetooth

         int getBluetooth()

        Whether a Bluetooth audio connection is active (best-effort). Read from the system on each call.

        Returns:

        1 if Bluetooth A2DP, SCO, or (API 31+) BLE headset is an active output device, 0 if not, or DEVICE_EXT_UNKNOWN_INT if unavailable

      • getDnd

         int getDnd()

        Whether Do Not Disturb (non-INTERRUPTION_FILTER_ALL) is active. Read from the system on each call.

        Returns:

        1 if interruption filter restricts interruptions (API 23+), 0 otherwise, or DEVICE_EXT_UNKNOWN_INT if unavailable (including API levels below M)

      • getHeadset

         int getHeadset()

        Whether wired analog headset/headphones or USB audio output (e.g. USB-C headphones) is active. Read from the system on each call.

        Returns:

        1 if a matching output device is present, 0 otherwise, or DEVICE_EXT_UNKNOWN_INT if unavailable

      • getScreenBrightness

         double getScreenBrightness()

        System screen brightness setting normalized to a fraction of the configured maximum (255), rounded to two decimal places (HALF_UP) in [0.0, 1.0] for alignment with device.ext.screenbright. Read from the system on each call.

        Returns:

        value in [0.0, 1.0] when known (two fractional digits, half-up), or DEVICE_EXT_UNKNOWN_DOUBLE if unknown / inaccessible.

      • registerIpUpdateService

         void registerIpUpdateService(@NonNull() POBDeviceIpUpdaterService deviceIpUpdaterService)

        Registers a network callback that persists throughout the application lifecycle to receive network state updates, ensuring profile configuration requests are triggered and the latest IP addresses are always available as deviceIp.

        Note: This method should be called only once during the first initialize call.

        Parameters:
        deviceIpUpdaterService - The POBDeviceIpUpdaterService instance responsible for registering callback mechanisms to obtain the most recent device IP address from profile configuration response headers.