Robin Fischer

Game programmer that wants to share and document.

Firebase In-App Messaging in Unity

TL;DR: In-App Messages can be added to Unity by using the Firebase Dependency Files. It works without much trouble but there are limitations.


In the last year I grew more and more attached to the Firebase service from Google. I think they offer great products which help apps and games. In-App Messaging is one of them and I think it is a great way to interact with your users without updating the app binary. Sadly there is no Unity support yet. But it can actually be used really easy already in Unity.

Please don’t confuse this feature with Cloud Messaging which is used for native push notifications.

Add to Unity

Before trying to add In-App Messaging to Unity please follow the instructions to install Firebase Analytics into Unity since this is a hard dependency of In-App Messaging. You also have to add code to your game to initialize Firebase.

The instructions state that we have to add dependencies to the build.gradle (Android) and the Podfile (iOS). On Unity we don’t have these files directly. But we have a working m2 repository through the Google Play Resolver provided by Google.

In the Unity project you should find “Dependency” Files under the path Assets/Firebase/Editor. For example I have AnalyticsDependencies.xml and MessagingDependencies.xml. To any of these files you can add the required dependencies.


<iosPod name="Firebase/InAppMessagingDisplay" version="6.9.0" minTargetSdk="8.0">

Add these lines between the <iosPods> tags. The version (here 6.9.0) should match the other versions found in the same file.


<androidPackage spec="">

Add these lines between the <androidPackages> tags. For the version (here 19.0.2) I could not find a clear version structure to guide along. I just used the latest version. You can check the Release Notes to find more information.


For Android run the Google Play Resolver if it did not recognize the changes automatically by using Assets->Play Services Resolver->Android->Resolve. If you now build to device everything should be setup and you can start testing.


For up-to-date testing instructions check HERE

My two cents:

  • On iOS you have to pass -FIRDebugEnabled in Xcode on start to test on device. This only works if you re-install the app on the device since it is cached a start
  • You HAVE to send the App into background and come to foreground to see test messages

Notify App about changes

Normally to do something in game when the user clicks on the In-App Message you would subscribe to some handlers described HERE. This does not work out of the box since you would first have to add the native bindings in C#. Check my post Unity native call reference to get some help with that.

But there is an easier way. You can use Firebase Dynamic Links as action in the In-App Message. Unity does support Firebase Dynamic Links so this notifies your app that the user pressed the popup. You then just have to pass some parameters. You could also use some direct links like myapp://message-clicked.example and catch that in Unity.


Support for this awesome feature can be added very easily and of course there are limitations until Google adds native support for In-App Message in Unity.

Newer >>