> For the complete documentation index, see [llms.txt](https://oph3zdev.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://oph3zdev.gitbook.io/docs/free/phone/exports/client.md).

# Client

Client side exports

### usePhone

```lua
exports['oph3z-phone']:usePhone()
```

Opens the phone. This is the export you point an inventory item at:

```lua
['phone'] = {
    label = 'Phone',
    client = { export = 'oph3z-phone.usePhone' },
},
```

### OpenApp

```lua
exports['oph3z-phone']:OpenApp('message')
```

Opens the phone if it is closed, then opens the app. Works with built-in ids (`message`, `wallet`, `maps` …) and with third-party apps you registered yourself.

Returns `true` if the id was valid.

### IsOpen

```lua
local open = exports['oph3z-phone']:IsOpen()
```

`true` while the phone is on screen. Useful for blocking your own UI or actions while the player is using it.

### GetNumber

```lua
local number = exports['oph3z-phone']:GetNumber()
```

The player's formatted number, e.g. `555-0142`.

### GetIdentity

```lua
local me = exports['oph3z-phone']:GetIdentity()
```

Everything the phone knows about the owner:

```lua
{ number, numberRaw, citizenid, name, email, avatar }
```

Same timing note as `GetNumber` — `nil` until the phone has been opened.

### GetLanguage

```lua
local lang = exports['oph3z-phone']:GetLanguage()
```

The player's chosen language code (`en`, `tr` …), falling back to `Config.DefaultLocale`.

### Toast

```lua
exports['oph3z-phone']:Toast('success', 'Delivery', 'Package dropped off', 'message')
```

Shows a small toast inside the phone. `kind` is `info`, `success` or `error`. The last argument is optional and only picks the icon.

This is a UI-only message: it appears while the phone is open and is not saved. For something the player should still see later, use the server export `PushNotification` instead.

### RegisterApp

```lua
exports['oph3z-phone']:RegisterApp({
    id    = 'mybank',
    label = 'My Bank',
    ui    = 'nui://my-resource/web/index.html',
    icon  = 'https://example.com/icon.png',
    place = 'grid',
})
```

Adds your own app to the phone. It runs in an iframe inside the phone, so it can be any web page. Returns `true` if it registered.

| Field         | Required | What it does                                                                                    |
| ------------- | -------- | ----------------------------------------------------------------------------------------------- |
| `id`          | yes      | Unique app id                                                                                   |
| `ui`          | yes      | The page to load. Use `nui://your-resource/path/index.html` for a page inside your own resource |
| `label`       |          | Name under the icon. Defaults to the id                                                         |
| `icon`        |          | Icon image URL                                                                                  |
| `place`       |          | `grid`, `dock` or `hidden`. Defaults to `grid`                                                  |
| `deletable`   |          | `false` stops players uninstalling it. Defaults to `true`                                       |
| `share`       |          | `true` lists your app in the Messages share sheet                                               |
| `developer`   |          | Shown on the App Store page                                                                     |
| `description` |          | Shown on the App Store page                                                                     |
| `headerImage` |          | Banner on the App Store page                                                                    |
| `swiperItems` |          | Screenshots on the App Store page                                                               |

There is a starter template with the full postMessage bridge — identity, notifications, share and ShareDrop — in the app template repo.

### UnregisterApp

```lua
exports['oph3z-phone']:UnregisterApp('mybank')
```

Removes an app you registered. Returns `true` if it existed.

{% hint style="info" %}
Apps are cleaned up automatically when the resource that registered them stops, so you rarely need to call this yourself.
{% endhint %}
