appLaunched static method

Future<void> appLaunched()

App launched This method will increment the app launch count.

Implementation

static Future<void> appLaunched() async {
  await useMonitoringMethod(() async {
    try {
      await writeValue("last_launch", DateTime.now().toString());
      int? count = await appLaunchCount();
      if (count == null) {
        await writeValue("first_launch", DateTime.now().toString());
        await writeValue("launch_count", "1");
        return;
      }
      count++;
      await writeValue("launch_count", count.toString());
    } on PlatformException catch (e) {
      NyLogger.error('App launch not recorded: ${e.message}');
    }
  });
}