Skip to content

Unity SDK quick start

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

Prerequisites

Anchor link to

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

Download the example project

Anchor link to

Clone the example project repository:

Terminal window
git clone https://github.com/Pushwoosh/pushwoosh-unity-sample.git

Configure the project

Anchor link to

Open Assets/Scripts/PushNotificator.cs and set the Pushwoosh initialization values:

Assets/Scripts/PushNotificator.cs
Pushwoosh.ApplicationCode = "XXXXX-XXXXX";
Pushwoosh.FcmProjectNumber = "XXXXXXXXXXXX";

Replace the ApplicationCode and FcmProjectNumber values with your Pushwoosh App Code and Firebase Project Number.

1. Set the Bundle Identifier
Anchor link to

In Unity, go to Edit > Project Settings > Player > iOS > Other Settings and set the Bundle Identifier to your bundle ID (e.g., com.example.pushwoosh).

2. Build and install dependencies
Anchor link to

Build the iOS project from Unity. Then navigate to the generated Xcode project directory and install the CocoaPods dependencies:

Terminal window
cd ios && pod install
3. Set the API Token
Anchor link to

Open the ios/Unity-iPhone.xcworkspace file in Xcode. In your Info.plist add the Pushwoosh Device API Token:

Info.plist
<key>Pushwoosh_API_TOKEN</key>
<string>__PUSHWOOSH_DEVICE_API_TOKEN__</string>
1. Set the package name
Anchor link to

In Unity, go to Edit > Project Settings > Player > Android > Other Settings and set the Package Name to your app’s package name (e.g., com.example.pushwoosh).

2. Add google-services.json
Anchor link to

Copy your google-services.json file to the Assets directory in your Unity project.

3. Set the API Token
Anchor link to

In your Assets/Plugins/Android/AndroidManifest.xml add the Pushwoosh Device API Token inside the <application> tag:

AndroidManifest.xml
<meta-data android:name="com.pushwoosh.apitoken" android:value="__YOUR_DEVICE_API_TOKEN__" />

Run the project

Anchor link to
  1. Build and run the project.
  2. Tap the Register for push notifications button.
  3. Grant permission for push notifications. The device will be registered with Pushwoosh.

Send a push notification

Anchor link to

Go to the Pushwoosh Control Panel and send a push notification to your registered device.