Unity

PushExpress -- SDK Unity

You will need to integrate your Push.Express account with Firebase.

Setup Firebase

  1. Go to Firebase Console and create a new project (or use existing one)

    You can use one project for all your apps.

  2. Open Project Settings -> General

  3. Create new Unity app or just download google-services.json from existing app

If you need to create new app, just:

  • Register it

  • Download google-services.json

  • Press next-next-next =)

  1. Put google-services.json to your Assets dir (like Assets/google-services.json)

Setup Push.Express

Get Firebase Private key

  1. Go to Firebase Console and create a new project (or use existing one)

    You can use one project for all your apps.

  2. Open Project Settings

  3. Go to Service accounts, press Generate new private key and save it to file private-key.json (you can use same key for all apps)

Integrate your Push.Express App with Firebase

  1. Go to your Push.Express account

  2. Open existing App settings or create a new App

  3. Switch type application Firebase

  4. Paste private-key.json file to Firebase Admin SDK private key textbox

Add sdk in your application

  1. Import the main resources TextMeshPro. To do this, go to Window > TextMeshPro > Import TMP Essential Resources > Press All > Press Import.

  2. Add package Newton json. To do this, go to Window > Package Manager > In the upper-left corner, click on the + > Install package by name... > Enter in input com.unity.nuget.newtonsoft-json > Press instal.

  3. Add SDK Firebase Messaging. To do this, go to the official download page Firebase Unity SDK > Download the latest SDK version (as .zip archive) > Unzip the downloaded archive to a convenient location on your computer > Inside the archive you will find several .unitypackage of files for various Firebase modules. Open Unity > Assets > Import Package > Custom Package > Select a file FirebaseMessaging.unitypackage > In the import window, select all files and press Import

  4. Add SDK Push Express. To do this, go to the GitHub page Push Express Unity SDK > Download SDK version (as .zip archive) > Unzip the downloaded archive to a convenient location on your computer. Open Unity > Assets > Import Package > Custom Package > Select a file PushExpressSdkV1.3.unitypackage > In the import window, select all files and press Import

  5. Add Push Express Prefab на сцену. Open Unity > Open the Project window > Go to Assets > PushExpress > Drag the Prefab from the Project window to the Hierarchy or Scene window > Prefab will appear on the stage and you can adjust its settings.

  6. Configure the Push Express Prefab settings. To do this, double-click on it in the Project window > Prefab Mode opens > In the Inspector window, set the parameters of your application. Paste the PUSH EXPRESS_APP_ID value of your application into the App Id Prefab field (the value of PUSH EXPRESS_APP_ID can be found in the Applications section of the personal account). Set the Platform and Platform Name parameters according to the type of your application.

  7. Add permissions to AndroidManifest if your app is for Android. To do this, go to Assets > Plugins > Android > AndroidManifest.xml > add the code inside the application section

   <uses-permission android:name="android.permission.INTERNET" />
   <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
   <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

Add android:theme="@style/Theme.AppCompat.Light.NoActionBar" in the activity tag

   <activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@style/Theme.AppCompat.Light.NoActionBar">

Last updated