Real-Time Uninstall Tracking — Flutter Integration
This guide covers the Flutter (Dart) app-side setup for Real-Time Uninstall Tracking on Android. Uninstall events are collected by Firebase Analytics (app_remove), forwarded via a Firebase Cloud Function, and sent to Netcore.
Platform note: Real-time uninstall tracking applies to Android only. Firebase automatically logs app_remove when the app package is removed.
Overview
| Step | Responsibility | Where to implement |
|---|---|---|
| 1 | Set a common identifier (Netcore ↔ Firebase) | Flutter app (this doc) |
| 2 | Mark app_remove as a conversion in Firebase | Firebase console (step 2) |
| 3 | Deploy Cloud Function to POST uninstall data to Netcore | Cloud Function (step 3) |
For prerequisites (Firebase Analytics, Blaze plan, Cloud Functions CLI), see the Android integration overview.
Prerequisites (Flutter)
- Netcore Smartech Flutter SDK (
smartech_base) initialized in your app (native Android SDK is initialized via the plugin). - Firebase configured in the Flutter project (
firebase_core,firebase_analytics). - Android target with Firebase Analytics enabled (same Firebase project used for Cloud Functions).
Add dependencies (versions may vary):
dependencies:
firebase_core: ^<version>
firebase_analytics: ^<version>
smartech_base:
path: ../smartech_base # or your published package
Initialize Firebase before setting default event parameters:
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
Step 1 — Set Up a Common Identifier (Dart)
Firebase must receive Netcore partner parameters on every Analytics event (including app_remove) so the Cloud Function can map uninstalls to Netcore contacts.
On native Android, this is done with FirebaseAnalytics.setDefaultEventParameters(). In Flutter, use the same API via firebase_analytics:
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:smartech_base/smartech_base.dart';
Future<void> setNetcorePartnerParamsAsFirebaseDefaults() async {
final String? partnerParams =
await Smartech().getPartnerParametersString();
if (partnerParams == null || partnerParams.isEmpty) {
// Partner string not ready yet — call again after SDK init / login
return;
}
await FirebaseAnalytics.instance.setDefaultEventParameters({
Smartech.SMT_PARTNER_PARAMETER_KEY: partnerParams,
});
}
Parameter key
smartech_base exposes the same key as the native SDK:
| Constant | Value | Purpose |
|---|---|---|
Smartech.SMT_PARTNER_PARAMETER_KEY | ncPartnerParameter | Netcore partner payload read by the Cloud Function (event.params.ncPartnerParameter) |
Smartech().getPartnerParametersString() delegates to the native Android/iOS SDK (getPartnerParametersString()), equivalent to the native snippet in the Set Up a Common Identifier section.
When to call setDefaultEventParameters
setDefaultEventParametersPer Netcore documentation:
- After Smartech SDK initialization — tracks uninstalls for anonymous users.
- After user login — refreshes parameters for identified users.
Steps 2 & 3 — Firebase console and Cloud Function
Flutter does not implement these steps; follow the official Android guide (same Firebase project and app_remove pipeline):
- Mark
app_removeas a conversion event — Firebase Console → Analytics → Events →app_remove→ Mark as conversion. - Create and deploy the Cloud Function — the function listens for
app_removeand POSTsncPartnerParameterto your Netcore webhook. ConfigureX_API_KEYandWEBHOOK_URLin the function (or pass them via default event parameters only if your deployed function readsevent.paramsfor those keys).
Full sample index.js, deploy commands, and caveats: Real-Time Uninstall Tracking for Android.
Updated about 13 hours ago
