# Demo Running Guide

The Demo projects help developers understand how the phone side and glasses side work together. Run the Demo first, then jump into scenario samples or API references. If you want to watch the full flow first, see the [Build an app in five minutes](../terminal-sdk/getting-started/视频教程.md#_1-build-an-app-in-five-minutes) video.

## Get the Demo Repository

Demo repository:

[https://gitee.com/as_pixar/glass3sdkdemo](https://gitee.com/as_pixar/glass3sdkdemo)

Clone it locally:

```bash
git clone https://gitee.com/as_pixar/glass3sdkdemo.git
```

The project structure, build commands, and source paths below are based on this repository.

## Project Structure

The Demo repository contains two independent Android projects:

- `glassdemo`: glasses-side Demo
- `glass3sdkphonedemo`: phone-side Demo

Open and build them separately.

## Environment

- Android Studio
- JDK 17
- Android SDK 34
- Android phone
- Rokid Glass 3 device

## Build Commands

### Build the Glasses Demo

```bash
cd glassdemo
./gradlew assembleDebug
```

### Build the Phone Demo

```bash
cd glass3sdkphonedemo
./gradlew assembleDebug
```

## First Debugging Tips

Run the phone-side Demo first, then run the glasses-side Demo.

Phone entry:

- `com.rokid.phone.ui.MainPhoneActivity`

Glasses entry:

- `com.rokid.glass.HomeActivity`

## Before Running

### Authentication parameters

`UserAuthInfo("", "")` in phone-side `MainPhoneActivity` is a placeholder. If online capabilities require real AK/SK values, fill in the authentication parameters first.

### Permissions

On first run, grant the required permissions, especially:

- Bluetooth
- Wi-Fi / Nearby
- Camera
- Microphone
- Notification listener
- Storage

### Hardware links

The following capabilities depend on real devices and real links:

- Bluetooth connection
- Wi-Fi P2P
- Video stream preview
- Notification sync
- OTA
- Ring connection

## Run the Demo

### Run the glasses Demo

1. Connect the glasses to your computer with the Glass3 data debug cable.
2. Confirm Android Studio recognizes the device, such as `Rokid RG-glasses`.
3. Select the glasses app module.
4. Run `glassdemo` on the glasses.

![Run glasses Demo](../../assets/image-20251122131215873.png)

### Run the phone Demo

1. Connect an Android phone to your computer.
2. Select the phone app module.
3. Install and start the phone Demo.
4. Scan and connect to Glass3 from the phone Demo.

After classic Bluetooth connects the phone and glasses demos, they can exchange messages and files.

![Phone Demo connected](../../assets/image-20251122153054440.png)

## Verify basic capabilities

Recommended verification order:

| Step | Capability | Expected result |
| --- | --- | --- |
| 1 | SDK initialization | Phone and glasses initialize successfully. |
| 2 | Bluetooth scan and connection | Phone can scan and connect to Glass3. |
| 3 | Messaging | Phone and glasses can exchange text messages. |
| 4 | File transfer | Small files can be transferred between phone and glasses. |
| 5 | P2P connection | Large files or AV features can use the P2P channel. |
| 6 | Media | Photo, video, or live preview can be triggered. |

If Bluetooth or P2P fails, see:

- [Bluetooth troubleshooting](/en/faq/蓝牙问题排查.md)
- [P2P troubleshooting](/en/faq/P2P问题排查.md)

## Next Step

- Browse [code samples](./samples.md).
- Read [glasses UI guidelines](/en/terminal-sdk/capabilities/设计规范.md) before building your own glasses-side UI.
- Open [API Reference](/en/terminal-sdk/api-reference/).
- Open [app downloads](./apps.md).
