Unity

**Download Plugin **Download Sample

To integrate Pushwoosh into your Unity Amazon app you need to do simple following steps:

Get the API KEY from Amazon according to the [Amazon guide](https://developer.amazon.com/sdk/adm/credentials.html). For a pre-release or “debug” version of your app, you must create an API Key and store it as the only data in a file named api_key.txt . **The api_key.txt file must be located inside the Assets/Plugins/Android/assets folder for your project.** Note: ADM cannot recognize your API Key if it contains any spaces or line breaks. For a release or “production” version of your app, you may not need to create an API Key. Only if you sign the release version of your app using your own certificate, must you create an additional API Key for the release version of your app. Otherwise, if you allow Amazon to sign your app on your behalf, you do not need to create an additional API Key.
**1.** Import [Unity push notification plugin](https://github.com/Pushwoosh/pushwoosh-unity/blob/master/Pushwoosh.unitypackage) into your **assets** folder in Unity.

2. Replace contents of Assets/Plugins/Android/AndroidManifest.xml with Assets/Plugins/Android/AndroidManifestAmazon.xml.

3. Replace PACKAGE_NAME in Assets/Plugins/Android/AndroidManifest.xml with your project package. Please note that in Unity it is called ‘Bundle Identifier’.

4. In Pushwoosh/Pushwoosh.cs enter your Pushwoosh Application ID.

public const string APP_CODE = "ENTER_PUSHWOOSH_APP_ID_HERE";
**5.** Create **PushNotificator.cs** script and attach it to **Camera Object** in the scene.
using UnityEngine; using System.Collections; public class PushNotificator : MonoBehaviour { void Start () { Pushwoosh.Instance.OnRegisteredForPushNotifications += onRegisteredForPushNotifications; Pushwoosh.Instance.OnFailedToRegisteredForPushNotifications += onFailedToRegisteredForPushNotifications; Pushwoosh.Instance.OnPushNotificationsReceived += onPushNotificationsReceived; } void onRegisteredForPushNotifications(string token) { Debug.Log("Received token: \n" + token); // do handling here } void onFailedToRegisteredForPushNotifications(string error) { Debug.Log("Error ocurred while registering to push notifications: \n" + error); // do handling here } void onPushNotificationsReceived(string payload) { Debug.Log("Received push notificaiton: \n" + payload); // do handling here } }
- - - - - -

That’s it! How easy is that?