Implemented retrieving device info

This commit is contained in:
dankito 2020-12-20 21:41:16 +01:00
parent c5bddd94b0
commit 0fbf376a89
4 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,16 @@
package net.dankito.utils.multiplatform.os
open class DeviceInfo(
open val manufacturer: String,
open val deviceModel: String,
open val osName: String,
open val osVersion: String,
open val osArch: String
) {
override fun toString(): String {
return "$manufacturer $deviceModel: $osName $osVersion"
}
}

View File

@ -0,0 +1,8 @@
package net.dankito.utils.multiplatform.os
expect class DeviceInfoRetriever {
fun getDeviceInfo(): DeviceInfo
}

View File

@ -0,0 +1,11 @@
package net.dankito.utils.multiplatform.os
actual class DeviceInfoRetriever {
actual fun getDeviceInfo(): DeviceInfo {
// TODO:
return DeviceInfo("", "", "", "", "")
}
}

View File

@ -0,0 +1,11 @@
package net.dankito.utils.multiplatform.os
actual class DeviceInfoRetriever {
actual fun getDeviceInfo(): DeviceInfo {
// TODO: retrieve manufacturer and device model
return DeviceInfo("", "", System.getProperty("os.name", ""), System.getProperty("os.version", ""), System.getProperty("os.arch", ""))
}
}