kochava_tracker 2.6.0 copy "kochava_tracker: ^2.6.0" to clipboard
kochava_tracker: ^2.6.0 copied to clipboard

A lightweight and easy to integrate SDK, providing first-class integration with Kochava’s installation attribution and analytics platform.

example/lib/main.dart

///
///  KochavaTracker (Flutter)
///
///  Copyright (c) 2020 - 2023 Kochava, Inc. All rights reserved.
///

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:kochava_tracker/kochava_tracker.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

// See the full documentation on usage https://support.kochava.com/sdk-integration/flutter-sdk-integration/
class _MyAppState extends State<MyApp> {
  String _deviceId = 'N/A';

  @override
  void initState() {
    super.initState();
    startSdk();
  }

  // Start the Kochava SDK and retrieve the Kochava Device ID.
  Future<void> startSdk() async {
    // Start the Kochava SDK.
    KochavaTracker.instance.registerAndroidAppGuid("YOUR_ANDROID_APP_GUID");
    KochavaTracker.instance.registerIosAppGuid("YOUR_IOS_APP_GUID");
    KochavaTracker.instance.setLogLevel(KochavaTrackerLogLevel.Trace);
    KochavaTracker.instance.start();

    // Retrieve the Kochava Device ID.
    String deviceId = await KochavaTracker.instance.getDeviceId();

    if (!mounted) return;

    setState(() {
      _deviceId = deviceId;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Kochava Plugin Sample'),
        ),
        body: Center(
            child: ListView(
          children: [
            Text('DeviceId: $_deviceId\n'),
          ],
        )),
      ),
    );
  }
}
7
likes
160
pub points
84%
popularity

Publisher

unverified uploader

A lightweight and easy to integrate SDK, providing first-class integration with Kochava’s installation attribution and analytics platform.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on kochava_tracker