【Defold】AndroidのBackキーでアプリを終了する
![](https://kazupon.org/wp-content/uploads/2019/07/what-is-defold1-1.png)
input ファイルを開きキーを登録します。
![](https://kazupon.org/wp-content/uploads/2019/12/2017-11-19_17.11.05.png)
目次
コード
on_input にコードを記述します。
function on_input(self, action_id, action)
-- backキーでアプリを終了させる。
if action_id == hash("back") and action.pressed then
print("You back")
msg.post("@system:", "exit", {code = 0})
end
end