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

StepResponsibilityWhere to implement
1Set a common identifier (Netcore ↔ Firebase)Flutter app (this doc)
2Mark app_remove as a conversion in FirebaseFirebase console (step 2)
3Deploy Cloud Function to POST uninstall data to NetcoreCloud 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:

ConstantValuePurpose
Smartech.SMT_PARTNER_PARAMETER_KEYncPartnerParameterNetcore 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

Per 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_remove as a conversion event — Firebase Console → AnalyticsEventsapp_removeMark as conversion.
  • Create and deploy the Cloud Function — the function listens for app_remove and POSTs ncPartnerParameter to your Netcore webhook. Configure X_API_KEY and WEBHOOK_URL in the function (or pass them via default event parameters only if your deployed function reads event.params for those keys).

Full sample index.js, deploy commands, and caveats: Real-Time Uninstall Tracking for Android.