rz9920
rz9920

Reputation: 1

How to get CPU usage programmatically with Kotlin Android?

I want to get CPU usage programmatically with Kotlin in an Android application. I tried using the HardwarePropertiesManager class but it seems like it can only be used in devices that are in enterprise mode, is there any alternative?

Upvotes: 0

Views: 2453

Answers (1)

Pemassi
Pemassi

Reputation: 642

If you look at this repo (https://github.com/AntonioRedondo/AnotherMonitor#retrieving-processes-info-since-android-oreo-80-api-26-august-2017), it is not possible since Android 8.0 (API 26). Seems like you can get only memory usage. However, if you still want for old versions, you can look at that repo to know how to get CPU usage, and convert Java code to Koltin (which is easy).

Upvotes: 1

Related Questions