Skip to content

feat(android): detect foldables #14212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

feat(android): detect foldables #14212

wants to merge 4 commits into from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Apr 29, 2025

currently only for testing

const win = Titanium.UI.createWindow({});
win.open();

console.log("isFoldable: " + Ti.App.Android.isFoldable);

Ti.App.addEventListener("windowState", function(e) {
	console.log("--------------------------------");
	console.log("folding state: " + e.state)
	console.log("folding occlusionType: " + e.occlusionType)
	console.log("folding orientation: " + e.orientation)
	console.log("folding isSeparating: " + e.isSeparating)
	console.log("--------------------------------");
})
  • new event windowState that will fire when the window state of a foldable is changing (opening up)
  • new property Ti.App.Android.isFoldable that will be true if there is a hinge (so a foldable)

Note:
Not sure if it is an emulator thing or not: it only works when you start the app in the open state. If it is closed it won't attach the listener and shows a warning that the size doesn't match 🤷 And the "closed" state is never fired, only the open and half open state.
Have to do some more tests here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant