Firebase depends heavily on Google Play Services which isn't available on Amazon’s FireOS. Here I discuss the available Firebase tools & features with Amazon-specific alternatives that you could possibly use on FireOS.
All Firebase features require Google Play Services and play services availability on the device is checked when a feature is attempted to be used. In case the device does not have Play Services installed most of the features seem to fail silently or log a warning message. Let's look into each feature and what actually works on Amazon's flavour of Android.
The realtime database works. The presence of the Play Services is checked, a warning message is logged but the database has a fallback implementation of the required classes. All database operations seem to work normally, without any problems.
Check out the log for more info:
W/GooglePlayServicesUtil: Cannot find Google Play services package name. android.content.pm.PackageManager$NameNotFoundException: com.google.android.gms at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:115) at amazon.content.pm.AmazonPackageManagerImpl.getPackageInfo(AmazonPackageManagerImpl.java:273) at com.google.android.gms.internal.zzro.getPackageInfo(Unknown Source) at com.google.android.gms.common.zze.zzby(Unknown Source) at com.google.android.gms.common.zze.zzbx(Unknown Source) at com.google.android.gms.common.zze.zzbs(Unknown Source) at com.google.android.gms.common.zze.isGooglePlayServicesAvailable(Unknown Source) at com.google.android.gms.common.zzc.isGooglePlayServicesAvailable(Unknown Source) at com.google.android.gms.common.GoogleApiAvailability.isGooglePlayServicesAvailable(Unknown Source) at com.google.android.gms.internal.zzqc$zzc.connect(Unknown Source) at com.google.android.gms.internal.zzqc$zzc.zza(Unknown Source) at com.google.android.gms.internal.zzqc.zza(Unknown Source) at com.google.android.gms.internal.zzqc.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:135) at android.os.HandlerThread.run(HandlerThread.java:61) W/InstanceID/Rpc: Failed to resolve REGISTER intent, falling back W/InstanceID/Rpc: Both Google Play Services and legacy GSF package are missing D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization. W/GooglePlayServicesUtil: Google Play Store is missing. I/FA: App measurement is starting up, version: 9452 I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE I/FirebaseInitProvider: FirebaseApp initialization successful ...
... W/GooglePlayServicesUtil: Google Play Store is missing. I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:3 and remote module com.google.android.gms.firebase_database:0 I/DynamiteModule: Selected local version of com.google.android.gms.firebase_database
Authentication does not work. The auth module fails silently with the same logged warning as the database but there is no local version of the Firebase Auth module so nothing happens.
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found. W/GooglePlayServicesUtil: Google Play Store is missing.
Both of these options will get you an auth token, however I cannot find a way to give the realtime database Android SDK that auth token for it to use (the only way is the Authentication SDK which we just stated doesn’t work).
An alternative if you have to have auth is to not use the Firebase Realtime database Android SDK and to use the Firebase Realtime REST api’s which do you let you pass a custom auth token.
Attempting to change behaviour with remote config does not work. When accessing the
FirebaseRemoteConfig.getInstance() there was only a warning log and the functionality fails silently.
W/GooglePlayServicesUtil: Google Play Store is missing. W/GooglePlayServicesUtil: Google Play Store is missing.
Following the tutorial on how to add the cloud messaging, I was not able to get any message through to my implementation of
Amazon Device Messaging could be used instead to achieve similar functionality.
The Firebase Analytics seem to work (I saw a number of
session_start events in the logs). Even the device model and Android versions are recognised correctly. On Android devices with Google Play Services there is also quite a lot of information about the users (e.g. gender, age, interests) which seems to be missing in the analytics events from the FireTV. However, that might be caused by the fact that I only had a small number of logged events in the console.
I also attempted to log custom events. Analytics events can take up to 24 hours to show up in the console so they did not appear straight away but after waiting for what felt like forever, it is confirmed custom events also work.
When I tried to manually log a non-fatal exception using the Crash Reporting static method
FirebaseCrash.report(Throwable, there was only the following log message:
V/FirebaseCrash: Firebase Crash Reporting is disabled.
When I tried crashing the app, nothing showed up in the console so again it’s not working.
If you cannot have Firebase analytics, an Amazon alternative is not necessary and I would recommend to use Crashyltics.
In conclusion you have 2 out of 6 features working. The main positive being the realtime database is the dominant feature of Firebase and this is working. However the combination of the authentication not working and the fact Google themselves neither confirm or deny guaranteed Amazon support should have you asking questions. Will this continue to work? Will any future updates or features work? More generally is Firebase viable for use on Amazon Android devices?
There are a few choices, if you are used to using Firebase on your Google Android devices none of them are ideal. Each has its tradeoffs, you may have to sacrifice functionality, learn more technologies, add complexity, delay your release or fight a holy war to unite the platforms. Some ideas are:
We plan, design, and develop the world’s most desirable software products. Our team’s expertise helps brands like Sony, Motorola, Tesco, Channel4, BBC, and News Corp build fully customized Android devices or simply make their mobile experiences the best on the market. Since 2008, our full in-house teams work from London, Liverpool, Berlin, Barcelona, and NYC.
Let’s get in contact