如何在React Native中衡量我的应用程序的数据使用情况? [英] How to measure the data usage of my app in react native?
问题描述
我有一个本机应用程序,我想测量每个用户的数据使用量,然后收集它们以进行优化.
I have a react-native app that I want to measure the data usage per user and gather them to optimize it later.
我看到了有关本机android的旧问题,这些问题提示trafficStats可能会通过UUID提供统计信息.
I saw old questions for native android suggesting that trafficStats may give stats by UUID.
本机反应有什么可能性?
What possibilities are there for react-native?
推荐答案
使用react-native意味着您有两个选择,
Using react-native means that you have two options,
-
本机实现取决于您正在使用的操作系统.
The native implementation which depends on the OS you're working on.
如果您正在使用JS库进行网络连接(Axios)甚至是内置函数(fetch),则可以实现包装器Promise,该包装器将计算任何输入/输出字符串的长度+长度的近似值标题的
If you're using a JS library for networking (Axios) or even a builtin function (fetch) you can implement a wrapper Promise which calculates the length of any input/output string, + an approximation of the length of the header.
这篇关于如何在React Native中衡量我的应用程序的数据使用情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!