> For the complete documentation index, see [llms.txt](https://cylexdev.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cylexdev.gitbook.io/docs/cylex-phone/exports-and-events/adding-custom-apps/events.md).

# Events

Listen for custom app lifecycle and communication events. Client-Side

```lua
-- Fired when the user opens a custom app.
AddEventHandler('cylex_phone:customApp:opened', function(appId)
    print("User opened custom app: " .. appId)
end)

-- Fired when the user navigates away from a custom app.
AddEventHandler('cylex_phone:customApp:closed', function(appId)
    print("User closed custom app: " .. appId)
end)

-- Fired when the custom app sends a message back to its owning resource.
-- The event name is: {your_resource_name}:phoneApp:event
AddEventHandler('my_resource:phoneApp:event', function(appId, action, data)
    print("Received event from app: " .. appId .. " action: " .. action)
end)
```
