How to measure the data usage of my app in react native?

五迷三道 提交于 2020-03-18 03:52:51

问题


I have a react-native app that I want to measure the data usage per user and gather them to optimize it later.

I saw old questions for native android suggesting that trafficStats may give stats by UUID.

What possibilities are there for react-native?


回答1:


Using react-native means that you have two options,

  1. The native implementation which depends on the OS you're working on.

  2. 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.



来源:https://stackoverflow.com/questions/45572570/how-to-measure-the-data-usage-of-my-app-in-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!