Skip to main content

Before you begin

Here’s what you need to know before getting started: Requirements:

Android

Connect Firebase Cloud Messaging (FCM) with Linkrunner
To configure FCM HTTP V1 for uninstalls:Enable the FCM API:
  1. Go to the FCM console.
  2. Select a project.
  3. Go to Project Overview > Project settings.
  4. Copy the Project ID. This will be required in a later step. Project ID
  5. Go to the Cloud Messaging tab.
  6. Make sure that Firebase Cloud Messaging API (V1) is set to Enabled.
Create a custom role for Linkrunner Uninstall:
  1. Go to the Service accounts tab.
  2. Click Manage service account permissions.
  3. A new browser tab opens in Google Cloud Platform.
  4. In the side menu, select Roles.
  5. Click + Create role.
  6. Enter the following details:
    • Title: Linkrunner Uninstalls
    • ID: lr_uninstalls
    • Role launch stage: General availability
  7. Click + Add permissions.
  8. In Enter property name or value field, enter cloudmessaging.messages.create and select it from the search results. Google Cloud Permission
  9. Check the cloudmessaging.messages.create option and click Add.
  10. Click Create.
Assign Linkrunner the FCM uninstall role:
  1. In the side menu, select IAM.
  2. Open the View by Principals tab.
  3. Click Grant Access.
  4. In Add Principals -> New principals field, enter lr-uninstalls-tracking@lr-uninstalls-tracking.iam.gserviceaccount.com
  5. In Assign Roles -> Select a role field, enter Linkrunner Uninstalls and select it from the search results.
  6. Click Save.
The Linkrunner service account has been assigned the role of Linkrunner Uninstalls.
  1. In Linkrunner, go to Settings > Uninstall Tracking.
  2. Under the Android tab, enter the Firebase Project ID that you copied initially and click Save. Uninstall Tracking
Follow these instructions to integrate FCM with the Linkrunner SDK:
  1. Set up Firebase Cloud Messaging:
Set up Firebase Cloud Messaging in your flutter app. See the Firebase Cloud Messaging documentation for detailed instructions.
  1. Configure your app to provide the device’s push token to the Linkrunner SDK.
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:linkrunner/linkrunner.dart';

class MyFirebaseMessagingService {

    static Future<void> initialize() async {
        // Fetch FCM token and set in Linkrunner SDK
        String? token = await FirebaseMessaging.instance.getToken();
        if (token != null) {
            await LinkRunner().setPushToken(token);
        }
    }

    static void setupTokenRefresh() {
        // Receive new FCM token and set in Linkrunner SDK
        FirebaseMessaging.instance.onTokenRefresh
            .listen((fcmToken) async {
                await LinkRunner().setPushToken(fcmToken);
            })
            .onError((err) {
                // Error getting token.
            });
    }

    static void setupMessageListener() {
        FirebaseMessaging.onMessage.listen((RemoteMessage message) {
            if (message.data.containsKey("lr-uninstall-tracking")) {
                return;
            } else {
                // Handle other data payloads here
            }
        });
    }
}
Custom implementations of FCM’s onMessageReceived method can unintentionally make uninstall push notifications visible to users, disrupting the intended silent experience. To avoid this, ensure your logic checks if the message contains lr-uninstall-tracking and handles it accordingly, as shown in the code example above.

iOS

Connect APNs with Linkrunner
Get the required credentials from the Apple Developer Portal:APNs Authentication Key (p8) and Key ID:
  • Go to the Apple Developer Portal.
  • Select Identifiers under Certificates, IDs & Profiles.
  • Click on the app you want to track uninstalls for. Then, under Capabilities, search for Push Notifications and enable it.
  • Under Certificates, IDs & Profiles, select Keys and click on plus (+) icon to create a key. Enable APNs when creating the key and download the key file (p8).
  • The Key ID can be found in the Keys tab.
Bundle ID and Team ID:
  • Under Identifiers, click on your app and you will see the Bundle ID and Team ID (App ID Prefix).
  1. In Linkrunner, go to Settings > Uninstall Tracking.
  2. Under the iOS tab, upload the APNs Authentication Key (p8) file and enter the Key ID, Bundle ID and Team ID (App ID Prefix) that you copied from the Apple Developer Portal. Uninstall Tracking
Follow these instructions to integrate FCM with the Linkrunner SDK:
  1. Set up Firebase Cloud Messaging:
Set up Firebase Cloud Messaging in your flutter app if you haven’t already. See the Firebase Cloud Messaging documentation for detailed instructions.
  1. Configure your app to provide the device’s APNs token to the Linkrunner SDK.
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:linkrunner/linkrunner.dart';

class MyFirebaseMessagingService {

    static Future<void> initialize() async {
        // Fetch APNs token and set in Linkrunner SDK
        String? token = await FirebaseMessaging.instance.getAPNSToken();
        if (token != null) {
            await LinkRunner().setPushToken(token);
        }
    }
}