Skip to content

Commit 4739bc7

Browse files
committed
Add support to detect Samsung One UI
1 parent fd6f79d commit 4739bc7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

dynamic-utils/src/main/java/com/pranavpandey/android/dynamic/util/DynamicDeviceUtils.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2022 Pranav Pandey
2+
* Copyright 2017-2024 Pranav Pandey
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -346,6 +346,21 @@ public static void vibrate(@Nullable Context context, long duration) {
346346
return dateFormat.format(milliSeconds);
347347
}
348348

349+
/**
350+
* Checks whether the device has a One UI version installed.
351+
*
352+
* @return {@code true} if the device has a One UI version installed.
353+
*/
354+
@SuppressWarnings("JavaReflectionMemberAccess")
355+
public static boolean isSamsungOneUI() {
356+
try {
357+
return Build.VERSION.class.getDeclaredField("SEM_PLATFORM_INT")
358+
.getInt(null) >= 9000;
359+
} catch (Exception e) {
360+
return false;
361+
}
362+
}
363+
349364
/**
350365
* Checks whether the device has MIUI services installed.
351366
*

0 commit comments

Comments
 (0)