Device Info

The library that allows you to obtain information about the device.

Permissions

Permissions=DeviceInfo

Dependency libraries

  • dbus-1

Device General

  • Unique device identifier.
  • Global Navigation Satellite System.
  • Near Field Communication.
  • Short-range wireless technology standard.
  • Wireless Local Area Network.
  • The highest reported CPU clock speed.
  • Number of cores of the system.
  • Current battery charge in percentage.
  • Main camera resolution.
  • Frontal camera resolution.
  • Random-access memory total size.
  • Random-access memory free size.
  • The clarity and detail of visuals displayed on a device.
  • Operating system version.
  • Device model name.

Device SIM Cards

  • Information about the device's SIM cards.

Device Storages

  • Information on external storage the device.
  • Information on internal storage the device.

Example

class AuroraDeviceInfo {
    fun id(): String {
        return DeviceInfo.id()
    }

    fun hasGNSS(): Boolean {
        return DeviceInfo.hasGNSS()
    }

    fun hasNFC(): Boolean {
        return DeviceInfo.hasNFC()
    }

    fun hasBluetooth(): Boolean {
        return DeviceInfo.hasBluetooth()
    }

    fun hasWlan(): Boolean {
        return DeviceInfo.hasWlan()
    }

    fun getMaxCpuClockSpeed(): UInt {
        return DeviceInfo.getMaxCpuClockSpeed()
    }

    fun getNumberCpuCores(): UInt {
        return DeviceInfo.getNumberCpuCores()
    }

    fun getBatteryChargePercentage(): UInt {
        return DeviceInfo.getBatteryChargePercentage()
    }

    fun getMainCameraResolution(): Double {
        return DeviceInfo.getMainCameraResolution()
    }

    fun getFrontalCameraResolution(): Double {
        return DeviceInfo.getFrontalCameraResolution()
    }

    fun getRamTotalSize(): ULong {
        return DeviceInfo.getRamTotalSize()
    }

    fun getRamFreeSize(): ULong {
        return DeviceInfo.getRamFreeSize()
    }

    fun getScreenResolution(): String {
        return DeviceInfo.getScreenResolution()
    }

    fun getOsVersion(): String {
        return DeviceInfo.getOsVersion()
    }

    fun getDeviceModel(): String {
        return DeviceInfo.getDeviceModel()
    }
}

data class SharedSimCard(
    val enabled: Boolean,
    val operatorName: String,
    val preferredDataTransfer: Boolean,
    val preferredVoiceCall: Boolean,
    val simName: String,
)

class AuroraSimCards {
    fun getSimCardsInfo(): List<SharedSimCard> {
        return DeviceSim.getSimCardsInfo().map {
            SharedSimCard(
                enabled = it.enabled,
                operatorName = it.operatorName,
                preferredDataTransfer = it.preferredDataTransfer,
                preferredVoiceCall = it.preferredVoiceCall,
                simName = it.simName,
            )
        }
    }
}

data class SharedExternalStorage(
    val bytesAvailable: ULong,
    val bytesTotal: ULong,
    val bytesUsed: ULong,
    val countMountedPartitions: UInt,
    val deviceLabel: String,
    val mounted: Boolean,
)

data class SharedInternalStorage(
    val bytesAvailable: ULong,
    val bytesTotal: ULong,
    val bytesUsed: ULong,
    val deviceLabel: String,
    val filesystemType: String,
)

class AuroraStorageInfo {
    fun getExternalInfo(): SharedExternalStorage {
        return DeviceStorage.getExternalInfo().let {
            SharedExternalStorage(
                bytesAvailable = it.bytesAvailable,
                bytesTotal = it.bytesTotal,
                bytesUsed = it.bytesUsed,
                countMountedPartitions = it.countMountedPartitions,
                deviceLabel = it.deviceLabel,
                mounted = it.mounted,
            )
        }
    }

    fun getInternalInfo(): SharedInternalStorage {
        return DeviceStorage.getInternalInfo().let {
            SharedInternalStorage(
                bytesAvailable = it.bytesAvailable,
                bytesTotal = it.bytesTotal,
                bytesUsed = it.bytesUsed,
                deviceLabel = it.deviceLabel,
                filesystemType = it.filesystemType,
            )
        }
    }
}