Skip to main content

getFoldableState

Description

Returns the name of the current fold state of a foldable device as a string.

Use it when you need more detailed state information than isUnfolded() or isFolded gives you.

Parameters

None

Returns

TypeValueDescription
String"folded"The device is folded
String"unfolded"The device is unfolded
String"unknown"The state cannot be detected (including regular devices)

Notes

  • This feature works on foldable Android devices only.
  • ⚠️ Caution: On regular devices — desktop included — it returns "folded" rather than "unknown". Internally it falls back to folded when no displayFeatures are present, which is a known issue.
  • If you only need a simple true/false check, use isUnfolded().

Example

// Check the current fold state string
var state = $app.getFoldableState();
console.log("폴드 상태:", state); // "folded", "unfolded", "unknown"

// Branch on each state
switch (state) {
case "unfolded":
console.log("펼쳐진 상태 - 와이드 레이아웃");
break;
case "folded":
console.log("접힌 상태 - 컴팩트 레이아웃");
break;
default:
console.log("일반 기기 또는 상태 미감지");
}
  • $app.isUnfolded() — Returns whether the device is unfolded as a bool
  • $vm.onFoldableStateChanged(state, isFolded, isUnfolded) — Fold state change event