Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Use this code to determine whether your app is running on a Surface Duo dual-screen device. You should perform this check before you call APIs from the Surface Duo SDK that interact with the Surface Duo device.
fun isDeviceSurfaceDuo(): Boolean {
val feature = "com.microsoft.device.display.displaymask"
val pm = this.packageManager
return if (pm.hasSystemFeature(feature)) {
Log.i(TAG, "System has feature: $feature")
true
} else {
Log.w(TAG, "System missing feature: $feature")
false
}
}
Caution
You could query the device name, but that is a hardcoded value that is not future-proof; we don't recommend this.