FLUTTER ECOSYSTEM

Zfinix/data_usage

Zfinix/data_usage open-source repository details.

数据使用量 项目封面
Stars
10
Forks
16
最近推送(UTC)
2024年2月1日
项目状态
未归档
Chiziaruhoma Ogbonda GitHub avatar
GITHUB User

Chiziaruhoma Ogbonda ↗

Systems & Harness Engineer

语言KotlinDartSwiftRubyObjective-C

此仓库发布的插件

使用的依赖

依赖清单 2 项
  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

Data Usage

Data Usage gets Mobile/Wifi data usage values from mobile devices, on android it will fetch the data per app but due to current limitations on ios it can only give the total/complete values of overall data used.

Screen Shots

https://github.com/Zfinix/data_usage/blob/main/1.png?raw=true

Usage for Android

  • Initialize plugin and requests for permission
  • Request Data usage stats
  DataUsageModel.init() // Only Required for Android
  List<DataUsageModel> dataUsage = await DataUsage.dataUsageAndroid(
     withAppIcon: true, // if false `DataUsageModel.appIconBytes` will be null
     dataUsageType: DataUsageType.wifi, // DataUsageType.wifi | DataUsageType.mobile
     oldVersion: false // will be true for Android versions lower than 23 (MARSHMELLOW)
   );

This would return:

   [   ...,
      DataUsageModel({
            String appName; //App's Name
            String packageName; // App's package name
            Uint8List appIconBytes; // Icon in bytes
            int received; // Amount of data Received
            int sent; // Amount of data sent/transferred
      })
   ]

For more explanation

Usage for iOS

Request for Total data usage on iOS devices

  IOSDataUsageModel dataUsage = await DataUsage.dataUsageIOS();

This would return:

  IOSDataUsageModel({
     int wifiCompelete, // Total Amount of wifi data (received + sent)
     int wifiReceived, // Amount of wifi data Received
     int wifiSent, // Amount of data sent/transferred
     int wwanCompelete, // Total Amount of mobile data (received + sent)
     int wwanReceived, // Amount of mobile data Received
     int wwanSent // Amount of data sent/transferred
  });

Contribution

Lots of PR's would be needed to make this plugin standard, as for iOS there's a permanent limitation for getting the exact data usage, there's only one way arount it and it's super complex.