app_install_events 0.0.2 copy "app_install_events: ^0.0.2" to clipboard
app_install_events: ^0.0.2 copied to clipboard

PlatformAndroid

A Flutter package that enables detection of application installation and uninstallation events on Android devices.

example/lib/main.dart

import 'package:app_install_events/app_install_events.dart';
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<IUEvent> _events = [];

  late AppIUEvents _appIUEvents;

  @override
  void initState() {
    _appIUEvents = AppIUEvents();

    _appIUEvents.appEvents.listen((event) {
      if (event.type == IUEventType.installed) {
        print('App installed: ${event.packageName}');
      } else {
        print('App uninstalled: ${event.packageName}');
      }

      setState(() {
        _events.add(event);
      });
    });

    super.initState();
  }

  @override
  void dispose() {
    _appIUEvents.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('App Install/Uninstall Events'),
        ),
        body: ListView.builder(
          itemCount: _events.length,
          itemBuilder: (context, index) {
            final event = _events[index];
            return ListTile(
              title: Text(event.packageName),
              subtitle: Text(event.type.toString()),
            );
          },
        ),
      ),
    );
  }
}
2
likes
160
pub points
63%
popularity

Publisher

unverified uploader

A Flutter package that enables detection of application installation and uninstallation events on Android devices.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on app_install_events