Getting Started
Create a phone app in a separate FiveM resource using the 919PHONE SDK.
Requirements
amzn_smartphoneinstalled and started firstox_lib(for the template server callbacks)- App UI files listed in your resource
files {}block
Quick start
- Clone or download
amzn_smartphone_app_templateinto your resources folder. - Add
ensure amzn_smartphonethenensure amzn_smartphone_app_templateto your server config. - Restart the server.
- Open the phone, go to App Store, install Template App.
Register the app
From your resource client script:
exports['amzn_smartphone']:registerApp({
id = 'myapp',
label = 'My App',
icon = 'fa-star',
color = 'linear-gradient(135deg, #0a84ff 0%, #005ecb 100%)',
category = 'appstore', -- or 'default' if allowed in Config.AllowedDefaultApps
ui = 'web/index.html',
description = 'What your app does.',
version = '1.0.0',
developer = 'Your Name',
})Unregister when your resource stops:
exports['amzn_smartphone']:unregisterApp('myapp')Build the UI
Your HTML runs inside an iframe hosted by the phone. The phone injects 919phone-sdk.js automatically - do not bundle it yourself.
const data = await fetchNui('getData', { id: 1 })
onNuiEvent('refresh', (payload) => {
console.log('Live update', payload)
})
onSettingsChange((settings) => {
document.documentElement.dataset.theme = settings.theme
})Style with html[data-theme="dark"] and html[data-theme="light"].
Handle NUI callbacks
Use standard FiveM RegisterNUICallback in your resource client script:
RegisterNUICallback('getData', function(data, cb)
local result = lib.callback.await('myapp:server:getData', false, data)
cb(result)
end)fetchNui('getData', ...) routes through the phone proxy to the resource that registered the app while the app is open.
Push messages to the UI
From client:
exports['amzn_smartphone']:sendAppMessage('myapp', 'refresh', { updated = true })From server:
exports['amzn_smartphone']:sendAppMessage(source, 'myapp', 'refresh', { updated = true })Messages can only be sent by the resource that registered the app.
Listen in your UI with onNuiEvent('refresh', handler).
Notifications with deep links
exports['amzn_smartphone']:notify(source, {
appId = 'myapp',
app = 'My App',
title = 'Update ready',
body = 'Tap to open.',
route = { tab = 'inbox' },
})When the player taps the notification, the phone opens your app and delivers the route via onNuiEvent('route', ...).
Next steps
- Read the SDK API reference
- Review the exports reference for phone helpers
- Configure limits in
Config.Sdkinsideconfig.lua