# เริ่มต้นใช้งาน React Native SDK อย่างรวดเร็ว

เริ่มต้นใช้งาน Pushwoosh React Native SDK โดยใช้ตัวอย่างที่ง่ายและรวดเร็วนี้

## ข้อกำหนดเบื้องต้น

ในการผสาน Pushwoosh React Native SDK เข้ากับแอปของคุณ คุณจะต้องมีสิ่งต่อไปนี้:

<TranslatedFragment id="prerequisites-plugins" />

## ดาวน์โหลดโปรเจกต์ตัวอย่าง

```bash
# โคลน repository ของ SDK และไปที่โปรเจกต์ตัวอย่าง
git clone https://github.com/Pushwoosh/pushwoosh-react-native-plugin.git

# ไปที่ไดเรกทอรี example
cd pushwoosh-react-native-plugin/example/demoapp/
```

## กำหนดค่าโปรเจกต์

ติดตั้ง dependencies:

```bash
npm install
```

เปิด **Settings.js** และอัปเดตการเรียก `Pushwoosh.init`:

```javascript
Pushwoosh.init({ "pw_appid" : "__YOUR_APP_ID__" });
```

แทนที่ `__YOUR_APP_ID__` ด้วย **Pushwoosh App Code** ของคุณ

### iOS

###### 1. ติดตั้ง dependencies

ไปที่ไดเรกทอรี ios และติดตั้ง dependencies:

```bash
cd ios && pod install --repo-update
```

###### 2. ตั้งค่า Bundle Identifier

เปิดไฟล์ **ios/Runner.xcworkspace** ใน Xcode

ตั้งค่า **Bundle Identifier** สำหรับแต่ละ target:

- `Runner`: ชื่อแพ็กเกจของแอปของคุณ (เช่น com.example.pushwoosh)
- `NotificationService`: ชื่อแพ็กเกจของแอปของคุณพร้อม `.NotificationServiceExtension` (เช่น com.example.pushwoosh.NotificationServiceExtension)

###### 3. ตั้งค่า API Token

ใน `ios/Runner/Info.plist` ของคุณ ให้ตั้งค่าคีย์ `Pushwoosh_API_TOKEN` เป็น [Pushwoosh Device API Token](/th/developer/api-reference/api-access-token/#device-api-token)


### Android

###### 1. ตั้งค่า google-services.json

คัดลอกไฟล์ `google-services.json` ของคุณไปยังไดเรกทอรี **android/app**

###### 2. ตั้งค่าชื่อแพ็กเกจ

เปิด **android/app/build.gradle** และตั้งค่า **applicationId** เป็นชื่อแพ็กเกจของแอปของคุณ (เช่น `com.example.pushwoosh`)

###### 3. ตั้งค่า API Token

เปิดไฟล์ **android/app/src/main/AndroidManifest.xml** ของคุณและเพิ่ม metadata ต่อไปนี้ภายในแท็ก `<application>`:

```xml title="AndroidManifest.xml"
<meta-data android:name="com.pushwoosh.apitoken" android:value="__YOUR_PUSHWOOSH_DEVICE_API_TOKEN__" />
```
แทนที่ `__YOUR_PUSHWOOSH_DEVICE_API_TOKEN__` ด้วย [Pushwoosh Device API Token](/th/developer/api-reference/api-access-token/#device-api-token) ของคุณ


## รันโปรเจกต์

1. บิวด์และรันโปรเจกต์
2. แอปจะมีสองแท็บ: "Actions" และ "Settings" ไปที่แท็บ **Settings**
3. แตะปุ่ม **Register for Push Notifications**
4. ให้สิทธิ์สำหรับการแจ้งเตือนแบบพุช อุปกรณ์จะถูกลงทะเบียนกับ Pushwoosh

## ส่งการแจ้งเตือนแบบพุช

กลับไปที่ Pushwoosh Control Panel และ [ส่งการแจ้งเตือนแบบพุช](/th/product/messaging-channels/push-notifications/send-push-notifications/one-time-push) ไปยังอุปกรณ์ที่ลงทะเบียนของคุณ