Decode a system Back intent
app.handle · app.resolve · exact host payloadshandle("system_back", "app", "intent:canGoBack")Native Back carries a positive intent ID plus a 1 or 0 host-history hint; the application must answer that exact intent once.
When to use it
Use this only after declaring navigation.history and deciding which application state owns Back priority.
- Close app-owned transient UI such as a modal before changing navigation.
- Use the parsed positive intent ID, never a locally invented number.
- A stale or repeated intent is rejected by the host.
- systemBackExit is host-dependent and must remain the final root-level decision.
Focused example
local intentText, canGoBackText = string.match(value, "^([1-9][0-9]*):([01])$")
local intent = if intentText == nil then nil else tonumber(intentText)
if action == "system_back" and target == "app" and intent ~= nil then
if modalOpen then
modalOpen = false
Host.systemBackHandled(intent)
elseif router.canBack() then
Host.systemBackHistory(intent)
elseif canGoBackText == "0" then
Host.systemBackExit(intent)
else
Host.systemBackHistory(intent)
end
end