Skip to content

Instantly share code, notes, and snippets.

View starry-shivam's full-sized avatar
🌟
Focusing

Stɑrry Shivɑm starry-shivam

🌟
Focusing
View GitHub Profile
@starry-shivam
starry-shivam / LogcatFlow.kt
Created May 27, 2024 08:03
Get logcat for your app as a Kotlin flow
import android.os.Process
import android.util.Log
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.BufferedReader
@starry-shivam
starry-shivam / MiuiCheck.kt
Last active July 3, 2024 12:27
Check if the device is running either on MIUI or HyperOS
object MiuiCheck {
/**
* Check if the device is running on MIUI.
*
* By default, HyperOS is excluded from the check.
* If you want to include HyperOS in the check, set excludeHyperOS to false.
*
* @param excludeHyperOS Whether to exclude HyperOS
* @return True if the device is running on MIUI, false otherwise