Firebase extension for Haxe


Is there a firebase extension that allows to do cloud messaging and analytics?

I found this one but it doesn’t have instructions so I’m not sure if it works:


Hey The creator of the Extension Heath Gifford said this in Slack when I asked about Documentation this is quoted from there.

"Sorry, I can’t make any documentation till I get time to do end-to-end testing, and I wont get time for that for months.
what ‘event system’ are you talking about?
sendFirebaseAnalyticsEvent is for FIREBASE ANALYTICS
FIREBASE MESSAGING is already included in the Android build. You include it in the build.gradle file
In extension-firebase/dependencies/android/build.gradle

dependencies {
compile project(’:deps:extension-api’)
compile '’
compile '’
compile ‘’

This is the only thing you need to do on Android to get Firebase Messaging activated
you can also check out the instructions here, to confirm,
So, to reiterate…
extension-firebase has Firebase Messaging enabled, without any action from you. It is enabled by including the firebase-messaging dependency in the build.gradle file
extension-firebase has a class, MyFirebaseInstanceIDService, that is calling String refreshedToken = FirebaseInstanceId.getInstance().getToken();
On the Firebase dashboard, you create an Application
Then use the Firebase NotificationBuilder to send notifications
This SHOULD be in a Readme, but I havent had time to actually test it end-to-end
and I need to have a separate set of instructions for iOS, it’s slightly different
sorry, but you’re kind of on your own from here :slightly_smiling_face:
Most of the setup for Push Notifications is APPLICATION SPECIFIC. It has nothing to do with an extension, or Haxe specific code"

Come Join the Slack if you haven’t already if you make any progress I’d love to learn from, and help where I can. This would be incredible to get end-end testing of push notifications in OpenFl!



I always prefer forums before chats like slack but I’ll try to get in touch.


I’m using HaxeFlixel and this is not compatible with older openfl.

I updated HaxeFlixel to dev so I can use newer openfl but now older extensions like admob and google play services are not working now.
The problem:

C:/HaxeToolkit/haxe/lib/extension-admob/1,6,4/extension/admob/AdMob.hx:74: characters 12-18 : Type not found : openfl.utils.JNI

I think I’m going back and I’m not using firebase.


Newer releases use lime.system.JNI instead of openfl.utils.JNI, this may be reflected in the latest GIT version of the admob extension (and isn’t released on haxelib?) or perhaps the library needs to be patched


It is not updated. I’ll try to change it locally.

Also it is the same problem for google play games extension:


I wanted to use this extension to push notifications. But when i try to compile, an error occurs.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ‘: app’.

A problem occurred configuring project ‘: deps: firebase’.
Could not resolve all dependencies for configuration ‘: deps: firebase: _debugCompile’.
Could not find firebase-core: 10.0.1.
Searched in the following locations:
Required by:
bin.deps: firebase: unspecified
Could not find firebase-messaging: 10.0.1.
Searched in the following locations:
Required by:
bin.deps: firebase: unspecified

I’m using haxedevelop

in the file build.gradle in the repositories, I registered
url ""
After that, the necessary firebase libraries were automatically loaded during compilation, but this error continues to appear.


from desperation, I began to try everything and did the following: at compile time, forcibly insert the line into bin / android / build.gradle

maven {url ""}

it turned out like this

allprojects {
      repositories {
            jcenter { url "" }
            maven { url "" }

now the project is compiled normally, although at each compilation it is necessary to insert this line again. (later I modified the template for the android in the folder with lime 6.0.1 to not do it any more)
But the application crashes when trying to request
Firebase.getInstanceIDToken ()

the application falls on the line
String idToken = FirebaseInstanceId.getInstance().getToken ();


I compiled my project in debug mode and get that exeption

01-24 16:50:14.054 30103 30103 E AndroidRuntime: FATAL EXCEPTION: main
01-24 16:50:14.054 30103 30103 E AndroidRuntime: Process: ru.ydvp.MyProject, PID: 30103
01-24 16:50:14.054 30103 30103 E AndroidRuntime: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process ru.ydvp.MyProject. Make sure to call FirebaseApp.initializeApp(Context) first.

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at Source)

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at Source)

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at$

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at android.os.Handler.handleCallback(

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at android.os.Handler.dispatchMessage(

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at android.os.Looper.loop(

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at$

01-24 16:50:14.054 30103 30103 E AndroidRuntime: at


A problem occurred configuring project ‘: deps: firebase’.
Yeah I got the same issue. and tried to look through the .gradle file but had no luck. From you current error did you call -> FirebaseApp.initializeApp(Context) ?


Yesterday I called FirebaseApp.initializeApp (Context)
But it did not work, the same error appears.
Today I’ll try one more variant of the call, I’ll report the results.

In AndroidStudio, I solved the task of push notifications very quickly. I hope I do not have to rewrite the whole project on the native, push notification is very important in the current project.

Please advise, there may be another option for implementing push notifications.


Has earned. Now I will try to send out push notifications. As soon as I finish I’ll try to write an instruction.
In the file build.gradle should be such a content:

buildscript {
	repositories {
		maven {
			url ""
	dependencies {
		classpath ''
		classpath ''
apply plugin: ''
android {
	compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
	buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
	sourceSets {
		main {
			manifest.srcFile 'AndroidManifest.xml'
			java.srcDirs = ['extension']
			res.srcDirs = ['res']
dependencies {
	compile project(':deps:extension-api')
	compile ''
	compile ''
	compile ''
apply plugin: ''

The last line is responsible for initializing the FIREBASE plugin. Therefore, FirebaseApp.initializeApp (Context) is not required.

and do not forget to put the google-services.json file

Next, in the AndroidManifest.xml file, you need to modify its package, you can take it from google-services.json

immediately after installation, you should wait a little while until the Firebase token is received from the Firebase server. In my application, I made a timer that once a second requests a token and stops working when it’s not null.

By the way, I managed to organize notifications and I already made a test mailing on the android.


You’re actually incredible! Oh my gosh thank you so much, and do you think you’ll be able to do the same for ios?


I already started to move in the direction of iOs, of course I faced some problems that I will try to solve today or (if it does not work out) next week.

By the way, yesterday, during the experiments with the android, I encountered some difficulty: when creating a project in Firebase, you need to create an application inside the project, where I created an error in the manual, as a result of which notifications were not delivered to the mobile phone, without any explanation. Plus, there still need to generate SHA-1, which seemed difficult to me. In order not to disassemble this whole gem, I used AndroidStudio to create a project there and run FirebaseAssistant which did everything automatically, then I just copied the package into my AndroidManifest.xml in the extension


PXshadow did you manage to get the notifications to work on your Android project?


I never did :frowning: . But you’re inspiring me to try again and work on it. and for for the android project setup do you have to create a new android studio every time?


No only once to create credentials in Firebase automatically. But you can do without AndroidStudio and fill in the data on Firebase manually.


hi, i am about to implement firebase analytics into my app , is it the same process for that too ? or it was a problem with just notification thing ? thanks


I tried only push notification and only on android, I think the events of the analysts work just as well.


ok , i will first try Android , and will update here . thanks