Unity SDK quick start
Get started with the Pushwoosh Unity SDK using this quick and simple example.
Prerequisites
Anchor link toTo integrate the Pushwoosh Unity SDK into your app, you will need the following:
Download the example project
Anchor link toClone the example project repository:
git clone https://github.com/Pushwoosh/pushwoosh-unity-sample.gitConfigure the project
Anchor link toOpen Assets/Scripts/PushNotificator.cs and set the Pushwoosh initialization values:
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 toIn 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 toBuild the iOS project from Unity. Then navigate to the generated Xcode project directory and install the CocoaPods dependencies:
cd ios && pod install3. Set the API Token
Anchor link toOpen the ios/Unity-iPhone.xcworkspace file in Xcode.
In your Info.plist add the Pushwoosh Device API Token:
<key>Pushwoosh_API_TOKEN</key><string>__PUSHWOOSH_DEVICE_API_TOKEN__</string>Android
Anchor link to1. Set the package name
Anchor link toIn 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 toCopy your google-services.json file to the Assets directory in your Unity project.
3. Set the API Token
Anchor link toIn your Assets/Plugins/Android/AndroidManifest.xml add the Pushwoosh Device API Token inside the <application> tag:
<meta-data android:name="com.pushwoosh.apitoken" android:value="__YOUR_DEVICE_API_TOKEN__" />Run the project
Anchor link to- Build and run the project.
- Tap the Register for push notifications button.
- Grant permission for push notifications. The device will be registered with Pushwoosh.
Send a push notification
Anchor link toGo to the Pushwoosh Control Panel and send a push notification to your registered device.