android_boot_info 1.0.0 copy "android_boot_info: ^1.0.0" to clipboard
android_boot_info: ^1.0.0 copied to clipboard

PlatformAndroid

A Flutter plugin for Android that provides boot time, uptime, awake time, and deep sleep statistics.

android_boot_info #

pub version platforms pub points license

A Flutter plugin for Android that provides boot time, uptime, awake time, and deep sleep statistics.

Features #

  • πŸ“… Boot time (DateTime, ISO string, milliseconds)
  • πŸ”„ Boot count
  • ⏱️ Uptime (Duration, milliseconds, seconds)
  • 🌞 Awake time (Duration, milliseconds, seconds, percent)
  • πŸŒ™ Deep sleep time (Duration, milliseconds, seconds, percent)

Getting Started #

Add the dependency in your pubspec.yaml:

dependencies:
  android_boot_info: ^1.0.0

Import the package:

import 'package:android_boot_info/android_boot_info.dart';

Usage #

import 'package:android_boot_info/android_boot_info.dart';

/// Boot time as a [DateTime].
final DateTime bootTime = await AndroidBootInfo.getBootTime();

/// Boot time formatted as ISO‑8601 string.
final String bootTimeISO = await AndroidBootInfo.getBootTimeISO();

/// Boot time in milliseconds since epoch.
final int bootTimeMs = await AndroidBootInfo.getBootTimeMs();

/// Number of times the device has booted.
final int bootCount = await AndroidBootInfo.getBootCount();
/// Total uptime since boot as [Duration].
final Duration uptimeDuration = await AndroidBootInfo.getUptimeDuration();

/// Uptime in milliseconds.
final int uptimeMs = await AndroidBootInfo.getUptimeMs();

/// Uptime in seconds.
final int uptimeSeconds = await AndroidBootInfo.getUptimeSeconds();
/// Total awake time since boot as [Duration].
final Duration awakeDuration = await AndroidBootInfo.getAwakeDuration();

/// Awake time in milliseconds.
final int awakeMs = await AndroidBootInfo.getAwakeMs();

/// Awake time in seconds.
final int awakeSeconds = await AndroidBootInfo.getAwakeSeconds();

/// Percentage of uptime spent awake.
final double awakePercent = await AndroidBootInfo.getAwakePercent();
/// Total deep sleep time since boot as [Duration].
final Duration deepSleepDuration = await AndroidBootInfo.getDeepSleepDuration();

/// Deep sleep time in milliseconds.
final int deepSleepMs = await AndroidBootInfo.getDeepSleepMs();

/// Deep sleep time in seconds.
final int deepSleepSeconds = await AndroidBootInfo.getDeepSleepSeconds();

/// Percentage of uptime spent in deep sleep.
final double deepSleepPercent = await AndroidBootInfo.getDeepSleepPercent();
/// πŸ”„ Refreshing Data
await AndroidBootInfo.refresh();

Note: By default, the plugin caches the last fetched snapshot.
Call AndroidBootInfo.refresh() to force a fresh read from the native side.

Platform Support #

Platform Support
Android βœ…

License #

BSD 3-Clause License. See LICENSE for details.

1
likes
160
points
60
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for Android that provides boot time, uptime, awake time, and deep sleep statistics.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on android_boot_info

Packages that implement android_boot_info