Get Started
Overview¶
Initially, this module is called Firebase
which basically define implementation for each Firebase functions. Some of that functions use what's called Google Services
or some people might say GMS, but recently GMS is no longer supported in Huawei Devices (more about that here) .
To support this module in Huawei devices, we changed the module name to Service
and provide implementation for GMS alternative that's called HMS. There are some Firebase feature that doesn't use GMS so we're not implementing the alternative of that (like crashlytics
and performance
), more on that here.
This module is refactored from the bottom-up to support new services, and to give the best implementation as possible. Many developers use product flavors for maintaining Android Application to use both GMS and HMS in one project. But using this module, no need for product flavor or build variant, this module will automatically define which service to use.
Service to use¶
When this module added to the project, it will check does the device support Google service or not from the given Context
. This table represent which service will be used by default either if Google Play service is supported or not:
Service Name | Is Google Service supported? | Status | Description | |
---|---|---|---|---|
Yes | No | |||
Crash Reporting | Firebase Crashlytics | ✔ | stable | |
Performance Monitoring | Firebase Performance | ✔ | stable | |
Analytics | Firebase Analytics | Huawei Analytics Kit | ✔ | stable |
Authentication | Firebase Authentication | AppGallery Connect Auth Service | ❌ | Google Authentication still failed in HarmonyOS |
Cloud Messaging | Firebase Cloud Messaging | Huawei Push Kit | ✔ | stable |
Dynamic Link | Firebase Dynamic Link | AppGallery Connect App Linking | ❌ | Getting Dynamic Link still not supported in Huawei SDK |
In-App Messaging | Firebase In-App Messaging | AppGallery Connect App Messaging | ✔ | stable |
Remote Configuration | Firebase Remote Configuration | AppGallery Connect Remote Configuration | ✔ | stable |
Info
For Crash Reporting
and Performance Monitoring
, if you want to use the Huawei service alternatives, you need to configure it respectively outside of module scope.
Configuration¶
You can use Firebase
or Huawei
independently, follow this steps based on service you will use
Firebase¶
- Add your
google-services.json
file in the project - In your root
build.gradle
, add another dependencies:build.gradlebuildscript { ... repositories { google() mavenCentral() } dependencies { ... classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1' classpath 'com.google.firebase:perf-plugin:1.4.0' } }
- In your app
build.gradle
add plugin:build.gradleapply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'com.google.firebase.firebase-perf'
Huawei¶
- Add your
agconnect-services.json
file in the project - In your root
build.gradle
, add another dependencies:build.gradlebuildscript { ... repositories { google() mavenCentral() maven { url = 'https://developer.huawei.com/repo/' } } dependencies { ... classpath 'com.android.tools.build:gradle:7.1.3' classpath 'com.huawei.agconnect:agcp:1.7.0.300' } }
- In your app
build.gradle
add plugin:build.gradleapply plugin: 'com.huawei.agconnect'