Phone
Community apps
Any resource can add an app to the phone with one export. They work the way LB Phone's custom apps do, with the same names and shapes, so an app written for one ports to the other with little change.
Adding an app
A resource registers an app and points at its own HTML page. The phone loads that page in an iframe.
exports.lwk_phone:AddCustomApp({
identifier = 'pizza', -- unique, not shown
name = 'Pizza This',
description = 'Order a pizza to wherever you are standing.',
developer = 'Example', -- optional
ui = GetCurrentResourceName() .. '/ui/index.html', -- leave out for an app that only runs a function
icon = 'https://cfx-nui-' .. GetCurrentResourceName() .. '/ui/icon.png',
defaultApp = false, -- true installs it for everyone, if the server allows it
landscape = false, -- open sideways, for games and video
price = 0, -- bank money charged on install (free on servers without money)
size = 412, -- kB, shown in the App Store
images = {}, -- App Store screenshots
keepOpen = false, -- apps without a ui close the phone when tapped unless this is set
onOpen = function() end, -- also onClose, onUse, onInstall, onDelete
})
An app is removed automatically when the resource that registered it stops. To remove it yourself:
exports.lwk_phone:RemoveCustomApp('pizza')
Talking to your page
Send data from Lua to your app's page:
exports.lwk_phone:SendCustomAppMessage('pizza', { action = 'orderReady', data = { minutes = 4 } })
Installing
Community apps appear in the App Store and players install the ones they want. defaultApp = true only puts an app straight on every home screen when the server sets autoInstallApps = true.
Apps written for LB Phone
Apps written for LB Phone run unchanged: the phone provides the same globals inside the app's page and the same export names.
Not built yet
GameMap,useCameraand the music selector for community apps.
Stuck? Ask on Discord
View as Markdown