# Capacitor SDK quick start

Get started with the Pushwoosh Capacitor SDK using this quick and simple example

## Prerequisites

To integrate the Pushwoosh Capacitor SDK into your app, you will need the following:

<TranslatedFragment id="prerequisites-plugins" />

## Download the example project

Clone the SDK repository:
```bash
git clone https://github.com/Pushwoosh/pushwoosh-capacitor-plugin.git
```

Navigate to the plugin directory:
```bash
cd pushwoosh-capacitor-plugin
```

## Build the plugin

Before running the example app, you need to build the Capacitor plugin.\
Install plugin dependencies:
```bash
npm i
```

Build the plugin:
```bash
npm run build
```

## Configure the example app

Navigate to the example app directory:

```bash
cd example
```

Install the app dependencies:

```bash
npm i
```

Build the web assets:

```bash
npm run build
```

Open **src/js/example.js** and update the `Pushwoosh.onDeviceReady` call:

```javascript
Pushwoosh.onDeviceReady({
    appid: "__YOUR_APP_CODE__"
});
```

Where:

`__YOUR_APP_CODE__` is the application code from the Pushwoosh Control Panel.

### iOS

###### 1. Install CocoaPods dependencies

Navigate to the iOS platform directory and install the CocoaPods dependencies:
```bash
cd ios/App
pod install --repo-update
cd ../..
```

###### 2. Sync Capacitor to iOS

After installing CocoaPods, sync the Capacitor configuration:

```bash
npx cap sync ios
```

###### 3. Open the iOS project

Open the project in Xcode:

```bash
npx cap open ios
```

###### 3. Set the Bundle Identifier

In Xcode, set the **Bundle Identifier** to your app's package name (e.g., `com.example.pushwoosh`).

###### 5. Add capabilities

To enable Push Notifications, you need to add certain capabilities.

In the `Signing & Capabilities` section, add the following capabilities:
- `Push Notifications`
- `Background Modes`. After adding this capability, check the box for `Remote notifications`.

###### 6. Set the API Token

Open `ios/App/App/Info.plist` in Xcode and add the following entry with your [Pushwoosh Device API Token](/developer/api-reference/api-access-token/#device-api-token):

```xml title="Info.plist"
<key>Pushwoosh_API_TOKEN</key>
<string>__YOUR_PUSHWOOSH_DEVICE_API_TOKEN__</string>
```

### Android

###### 1. Sync Capacitor to Android

Sync the Capacitor configuration to the Android platform:

```bash
npx cap sync android
```

###### 2. Setup google-services.json

Copy your `google-services.json` file to the **android/app** directory.

###### 3. Set the package name

Open **android/app/build.gradle** and set the **applicationId** to your app's package name (e.g., `com.example.pushwoosh`).

###### 4. Set the API Token

Open your **android/app/src/main/AndroidManifest.xml** file and add the following metadata inside the `<application>` tag:

```xml title="AndroidManifest.xml"
<meta-data android:name="com.pushwoosh.apitoken" android:value="__YOUR_PUSHWOOSH_DEVICE_API_TOKEN__" />
```
Replace `__YOUR_PUSHWOOSH_DEVICE_API_TOKEN__` with your [Pushwoosh Device API Token](/developer/api-reference/api-access-token/#device-api-token).

###### 5. Open the Android project

Open the project in Android Studio:

```bash
npx cap open android
```

## Run the project

1. Build and run the project.
2. Tap the **"Click Me!"** button.
3. Grant permission for push notifications. The device will be registered with Pushwoosh.

## Send a push notification

Go back to the Pushwoosh Control Panel and [send a push notification](/product/messaging-channels/push-notifications/send-push-notifications/one-time-push) to your registered device.