Перейти к содержанию

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 git@github.com:Pushwoosh/pushwoosh-unity-sample.git

Configure the project

Anchor link to

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

Assets/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 the iOS build profile set the Bundle Identifier to your bundle ID (eg. com.example.pushwoosh).

2. Install dependencies
Anchor link to

After completing iOS build navigate to the ios directory and install the dependencies:

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

Open the ios/Unity-iPhone.xcworkspace file in Xcode.
In your ios/Unity-iPhone/Info.plist set the __PUSHWOOSH_DEVICE_API_TOKEN__ key to 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 the Android build profile set the Package Name to your app’s package name (eg. com.example.pushwoosh).

2. Setup google-services.json
Anchor link to

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

3. Set the API Token
Anchor link to

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

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

Important: Be sure to give the token access to the right app in your Pushwoosh Control Panel. Learn more

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 back to the Pushwoosh Control Panel and send a push notification to your registered device.