Go to Firebase Console and create a new project (or use existing one)
You can use one project for all your apps.
Open Project Settings -> General
Create new Android 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 =)
Put google-services.json to your app dir (like <project>/app/google-services.json)
Add the plugin as a dependency to your project-level build.gradle.kts file: Root-level (project-level) Gradle file (/build.gradle.kts)::
// Top-level build file where you can add configuration options common to all sub-projects/modules.plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.compose) apply false// Add the dependency for the Google services Gradle plugin id("com.google.gms.google-services") version "4.4.2" apply false}
In your module (app-level) Gradle file (<project>/<app-module>/build.gradle.kts), add the Firebase Cloud Messaging dependency:
Paste private-key.json file to Firebase Admin SDK private key textbox
Add sdk in your application
Before proceeding with the integration, make sure you have already installed the Firebase SDK in your application. If not, follow steps 4-6 in the Firebase Cloud Messaging integration guide
Add the JitPack repository to your build file
Ensure you have the latest Android Studio and Android Gradle Plugin!
In your settings.gradle.kts, add the Jitpack repo to repositories list (only if you use Gradle Centralized Repository Declaration feature, default for new projects since Android Studio Electric Eel):
Unzip and rename directory to pushexpress-android-sdk
Place pushexpress-android-sdk near your app dir, for example
./
\- MyApplication
\- pushexpress-android-sdk
Step 3. Obfuscate SDK locally
You need Linux (Ubuntu) or MacOS, it will not work on Windows out of the box!
Open Terminal app and do next steps.
Ensure you have installed Perl, coreutils find and xargs commands
which perl && which find && which xargs && echo "OK"
In local SDK dir (pushexpress-android-sdk) run obfs.pl script
cd pushexpress-android-sdk
./scripts/obfs.pl
Get new SDK package name, use it in next steps instead of 'com.sdk.pushexpress'
You need to do this step for each app, so you need to have separate local SDK copy for each app!
But you don't need (and it is really bad) to repeat this step if you just want to update your app.
Step 4. Add local SDK dependency
In your settings.gradle add path to local SDK
// settings.gradle (Project Settings) in Android Studio
include ':sdkpushexpress'
project(':sdkpushexpress').projectDir = new File('../pushexpress-android-sdk/sdkpushexpress')
In your module (app-level) Gradle file (<project>/<app-module>/build.gradle), add the SDK dependency
// build.gradle (Module :app) in Android Studio
dependencies {
...
implementation project (":sdkpushexpress")
}
Run File->Sync Project with Gradle files in Android Studio
In your module (app-level) Gradle file (<project>/<app-module>/build.gradle), enable obfuscation (minifyEnabled true)
// build.gradle (Module :app) in Android Studio
android {
...
buildTypes {
release {
minifyEnabled true
...
Step 7. Build and try to send push
Select Release build variants for your app and SDK (don't forget to sign you app)
Build->Clean Project
Build->Build bundle(s) / APK(s)->Build APK(s)
Check obfuscation with decompiler, for example, jadx
cd ./MyApplication/app/build/outputs/apk/release/
jadx app-release.apk
grep -ril 'pushexpress' app-release/
find app-release/ -iname '*pushexpress*'
# you should see no files here
Now you can try to send push in you local device or emulator, make sure all works as expected.
Step 5. Build and try to send push
Use Push.Express Documentation to learn how to view app installs on your devices and send notifications.