Android: difference between data usage on a hotspot phone and on a phone using it











up vote
1
down vote

favorite












I am trying to compare the data usage difference between a phone using an other phone's hotspot and the hotspot of the phone.



On the phone having its hotspot turned on, I am using this code to compute the data usage of the hotspot(The result is display on a TextView (TextView) findViewById(R.id.data_seller)). I named this phone the server phone:



private void getNetworkStatsServer() {
NetworkStatsManager networkStatsManager;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
networkStatsManager = getApplicationContext().getSystemService(NetworkStatsManager.class);
NetworkStats networkStatsWifi = null;
NetworkStats networkStatsMobile = null;
try {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
if (networkStatsManager != null) {
networkStatsWifi = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,
"", 0, calendar.getTimeInMillis(), UID_TETHERING);
String suscribeId = "";
TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
if (tm != null) {
suscribeId = tm.getSubscriberId();
}
networkStatsMobile = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
suscribeId, 0, calendar.getTimeInMillis(), UID_TETHERING);
}
} catch (RemoteException e) {
e.printStackTrace();
}
NetworkStats.Bucket bucket;

if (networkStatsWifi != null) {
while (networkStatsWifi.hasNextBucket()) {
bucket = new NetworkStats.Bucket();
networkStatsWifi.getNextBucket(bucket);
mStartTXServer += bucket.getTxBytes();
mStartRXServer += bucket.getRxBytes();
}
}

if (networkStatsMobile != null) {
while (networkStatsMobile.hasNextBucket()) {
bucket = new NetworkStats.Bucket();
networkStatsMobile.getNextBucket(bucket);
mStartTXServer += bucket.getTxBytes();
mStartRXServer += bucket.getRxBytes();
}
}
}
mHandler.postDelayed(mRunnableServer, 1000);
}

mRunnableServer = new Runnable() {
public void run() {
long res = new long[2];
NetworkStatsManager networkStatsManager;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
networkStatsManager = getApplicationContext().getSystemService(NetworkStatsManager.class);
NetworkStats networkStatsWifi = null;
NetworkStats networkStatsMobile = null;
try {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
if (networkStatsManager != null) {
networkStatsWifi = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,
"", 0, calendar.getTimeInMillis(), UID_TETHERING);
networkStatsMobile = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
"", 0, calendar.getTimeInMillis(), UID_TETHERING);
}
} catch (RemoteException e) {
e.printStackTrace();
}
NetworkStats.Bucket bucket;

if (networkStatsWifi != null) {
while (networkStatsWifi.hasNextBucket()) {
bucket = new NetworkStats.Bucket();
networkStatsWifi.getNextBucket(bucket);
res[0] += bucket.getTxBytes();
res[1] += bucket.getRxBytes();
}
}
if (networkStatsMobile != null) {
while (networkStatsMobile.hasNextBucket()) {
bucket = new NetworkStats.Bucket();
networkStatsMobile.getNextBucket(bucket);
res[0] += bucket.getTxBytes();
res[1] += bucket.getRxBytes();
}
}
if (networkStatsMobile != null || networkStatsWifi != null) {
res[0] -= mStartTXServer;
res[1] -= mStartRXServer;
}
} else {
res[0] = TrafficStats.getUidTxBytes(UID_TETHERING) - mStartTXServer;
res[1] = TrafficStats.getUidRxBytes(UID_TETHERING) - mStartRXServer;
}

System.out.println("Value of Rx: " + res[0]);
System.out.println("Value of Tx: " + res[1]);

((TextView) findViewById(R.id.data_seller)).setText(String.valueOf(((double) (res[0] + res[1])) / 1048576) + "MB");
mHandler.postDelayed(mRunnableServer, 10000);
}
};


Concerning the phone using the hotspot to be connected on internet, I compute the total data usage of the Wifi.I named this phone the client phone



private void getNetworkStatsClient() {
mStartTXClient = TrafficStats.getTotalTxBytes();
mStartRXClient = TrafficStats.getTotalRxBytes();

mHandler.postDelayed(mRunnableClient, 1000);
}

mRunnableClient = new Runnable() {
public void run() {
long res = new long[2];
res[0] = TrafficStats.getTotalTxBytes() - mStartTXClient;
res[1] = TrafficStats.getTotalRxBytes() - mStartRXClient;

System.out.println("Value of Rx: " + res[0]);
System.out.println("Value of Tx: " + res[1]);

((TextView) findViewById(R.id.data_buyer)).setText(String.valueOf(((double) (res[0] + res[1])) / 1048576) + "MB");
mHandler.postDelayed(mRunnableClient, 10000);
}
};


I thought the result of both would have been more or less the same (More precisely, res[0]+res[1] in both runnable would have been more or less equal) because the client phone is using the server hotspot phone. However, the results are totally different (The data usage of the client phone is 50 times greater than the server phone).
Do you have an idea why?










share|improve this question


























    up vote
    1
    down vote

    favorite












    I am trying to compare the data usage difference between a phone using an other phone's hotspot and the hotspot of the phone.



    On the phone having its hotspot turned on, I am using this code to compute the data usage of the hotspot(The result is display on a TextView (TextView) findViewById(R.id.data_seller)). I named this phone the server phone:



    private void getNetworkStatsServer() {
    NetworkStatsManager networkStatsManager;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    networkStatsManager = getApplicationContext().getSystemService(NetworkStatsManager.class);
    NetworkStats networkStatsWifi = null;
    NetworkStats networkStatsMobile = null;
    try {
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DATE, 1);
    if (networkStatsManager != null) {
    networkStatsWifi = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,
    "", 0, calendar.getTimeInMillis(), UID_TETHERING);
    String suscribeId = "";
    TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
    if (tm != null) {
    suscribeId = tm.getSubscriberId();
    }
    networkStatsMobile = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
    suscribeId, 0, calendar.getTimeInMillis(), UID_TETHERING);
    }
    } catch (RemoteException e) {
    e.printStackTrace();
    }
    NetworkStats.Bucket bucket;

    if (networkStatsWifi != null) {
    while (networkStatsWifi.hasNextBucket()) {
    bucket = new NetworkStats.Bucket();
    networkStatsWifi.getNextBucket(bucket);
    mStartTXServer += bucket.getTxBytes();
    mStartRXServer += bucket.getRxBytes();
    }
    }

    if (networkStatsMobile != null) {
    while (networkStatsMobile.hasNextBucket()) {
    bucket = new NetworkStats.Bucket();
    networkStatsMobile.getNextBucket(bucket);
    mStartTXServer += bucket.getTxBytes();
    mStartRXServer += bucket.getRxBytes();
    }
    }
    }
    mHandler.postDelayed(mRunnableServer, 1000);
    }

    mRunnableServer = new Runnable() {
    public void run() {
    long res = new long[2];
    NetworkStatsManager networkStatsManager;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    networkStatsManager = getApplicationContext().getSystemService(NetworkStatsManager.class);
    NetworkStats networkStatsWifi = null;
    NetworkStats networkStatsMobile = null;
    try {
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.DATE, 1);
    if (networkStatsManager != null) {
    networkStatsWifi = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,
    "", 0, calendar.getTimeInMillis(), UID_TETHERING);
    networkStatsMobile = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
    "", 0, calendar.getTimeInMillis(), UID_TETHERING);
    }
    } catch (RemoteException e) {
    e.printStackTrace();
    }
    NetworkStats.Bucket bucket;

    if (networkStatsWifi != null) {
    while (networkStatsWifi.hasNextBucket()) {
    bucket = new NetworkStats.Bucket();
    networkStatsWifi.getNextBucket(bucket);
    res[0] += bucket.getTxBytes();
    res[1] += bucket.getRxBytes();
    }
    }
    if (networkStatsMobile != null) {
    while (networkStatsMobile.hasNextBucket()) {
    bucket = new NetworkStats.Bucket();
    networkStatsMobile.getNextBucket(bucket);
    res[0] += bucket.getTxBytes();
    res[1] += bucket.getRxBytes();
    }
    }
    if (networkStatsMobile != null || networkStatsWifi != null) {
    res[0] -= mStartTXServer;
    res[1] -= mStartRXServer;
    }
    } else {
    res[0] = TrafficStats.getUidTxBytes(UID_TETHERING) - mStartTXServer;
    res[1] = TrafficStats.getUidRxBytes(UID_TETHERING) - mStartRXServer;
    }

    System.out.println("Value of Rx: " + res[0]);
    System.out.println("Value of Tx: " + res[1]);

    ((TextView) findViewById(R.id.data_seller)).setText(String.valueOf(((double) (res[0] + res[1])) / 1048576) + "MB");
    mHandler.postDelayed(mRunnableServer, 10000);
    }
    };


    Concerning the phone using the hotspot to be connected on internet, I compute the total data usage of the Wifi.I named this phone the client phone



    private void getNetworkStatsClient() {
    mStartTXClient = TrafficStats.getTotalTxBytes();
    mStartRXClient = TrafficStats.getTotalRxBytes();

    mHandler.postDelayed(mRunnableClient, 1000);
    }

    mRunnableClient = new Runnable() {
    public void run() {
    long res = new long[2];
    res[0] = TrafficStats.getTotalTxBytes() - mStartTXClient;
    res[1] = TrafficStats.getTotalRxBytes() - mStartRXClient;

    System.out.println("Value of Rx: " + res[0]);
    System.out.println("Value of Tx: " + res[1]);

    ((TextView) findViewById(R.id.data_buyer)).setText(String.valueOf(((double) (res[0] + res[1])) / 1048576) + "MB");
    mHandler.postDelayed(mRunnableClient, 10000);
    }
    };


    I thought the result of both would have been more or less the same (More precisely, res[0]+res[1] in both runnable would have been more or less equal) because the client phone is using the server hotspot phone. However, the results are totally different (The data usage of the client phone is 50 times greater than the server phone).
    Do you have an idea why?










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am trying to compare the data usage difference between a phone using an other phone's hotspot and the hotspot of the phone.



      On the phone having its hotspot turned on, I am using this code to compute the data usage of the hotspot(The result is display on a TextView (TextView) findViewById(R.id.data_seller)). I named this phone the server phone:



      private void getNetworkStatsServer() {
      NetworkStatsManager networkStatsManager;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      networkStatsManager = getApplicationContext().getSystemService(NetworkStatsManager.class);
      NetworkStats networkStatsWifi = null;
      NetworkStats networkStatsMobile = null;
      try {
      Calendar calendar = Calendar.getInstance();
      calendar.add(Calendar.DATE, 1);
      if (networkStatsManager != null) {
      networkStatsWifi = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,
      "", 0, calendar.getTimeInMillis(), UID_TETHERING);
      String suscribeId = "";
      TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
      if (tm != null) {
      suscribeId = tm.getSubscriberId();
      }
      networkStatsMobile = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
      suscribeId, 0, calendar.getTimeInMillis(), UID_TETHERING);
      }
      } catch (RemoteException e) {
      e.printStackTrace();
      }
      NetworkStats.Bucket bucket;

      if (networkStatsWifi != null) {
      while (networkStatsWifi.hasNextBucket()) {
      bucket = new NetworkStats.Bucket();
      networkStatsWifi.getNextBucket(bucket);
      mStartTXServer += bucket.getTxBytes();
      mStartRXServer += bucket.getRxBytes();
      }
      }

      if (networkStatsMobile != null) {
      while (networkStatsMobile.hasNextBucket()) {
      bucket = new NetworkStats.Bucket();
      networkStatsMobile.getNextBucket(bucket);
      mStartTXServer += bucket.getTxBytes();
      mStartRXServer += bucket.getRxBytes();
      }
      }
      }
      mHandler.postDelayed(mRunnableServer, 1000);
      }

      mRunnableServer = new Runnable() {
      public void run() {
      long res = new long[2];
      NetworkStatsManager networkStatsManager;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      networkStatsManager = getApplicationContext().getSystemService(NetworkStatsManager.class);
      NetworkStats networkStatsWifi = null;
      NetworkStats networkStatsMobile = null;
      try {
      Calendar calendar = Calendar.getInstance();
      calendar.add(Calendar.DATE, 1);
      if (networkStatsManager != null) {
      networkStatsWifi = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,
      "", 0, calendar.getTimeInMillis(), UID_TETHERING);
      networkStatsMobile = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
      "", 0, calendar.getTimeInMillis(), UID_TETHERING);
      }
      } catch (RemoteException e) {
      e.printStackTrace();
      }
      NetworkStats.Bucket bucket;

      if (networkStatsWifi != null) {
      while (networkStatsWifi.hasNextBucket()) {
      bucket = new NetworkStats.Bucket();
      networkStatsWifi.getNextBucket(bucket);
      res[0] += bucket.getTxBytes();
      res[1] += bucket.getRxBytes();
      }
      }
      if (networkStatsMobile != null) {
      while (networkStatsMobile.hasNextBucket()) {
      bucket = new NetworkStats.Bucket();
      networkStatsMobile.getNextBucket(bucket);
      res[0] += bucket.getTxBytes();
      res[1] += bucket.getRxBytes();
      }
      }
      if (networkStatsMobile != null || networkStatsWifi != null) {
      res[0] -= mStartTXServer;
      res[1] -= mStartRXServer;
      }
      } else {
      res[0] = TrafficStats.getUidTxBytes(UID_TETHERING) - mStartTXServer;
      res[1] = TrafficStats.getUidRxBytes(UID_TETHERING) - mStartRXServer;
      }

      System.out.println("Value of Rx: " + res[0]);
      System.out.println("Value of Tx: " + res[1]);

      ((TextView) findViewById(R.id.data_seller)).setText(String.valueOf(((double) (res[0] + res[1])) / 1048576) + "MB");
      mHandler.postDelayed(mRunnableServer, 10000);
      }
      };


      Concerning the phone using the hotspot to be connected on internet, I compute the total data usage of the Wifi.I named this phone the client phone



      private void getNetworkStatsClient() {
      mStartTXClient = TrafficStats.getTotalTxBytes();
      mStartRXClient = TrafficStats.getTotalRxBytes();

      mHandler.postDelayed(mRunnableClient, 1000);
      }

      mRunnableClient = new Runnable() {
      public void run() {
      long res = new long[2];
      res[0] = TrafficStats.getTotalTxBytes() - mStartTXClient;
      res[1] = TrafficStats.getTotalRxBytes() - mStartRXClient;

      System.out.println("Value of Rx: " + res[0]);
      System.out.println("Value of Tx: " + res[1]);

      ((TextView) findViewById(R.id.data_buyer)).setText(String.valueOf(((double) (res[0] + res[1])) / 1048576) + "MB");
      mHandler.postDelayed(mRunnableClient, 10000);
      }
      };


      I thought the result of both would have been more or less the same (More precisely, res[0]+res[1] in both runnable would have been more or less equal) because the client phone is using the server hotspot phone. However, the results are totally different (The data usage of the client phone is 50 times greater than the server phone).
      Do you have an idea why?










      share|improve this question













      I am trying to compare the data usage difference between a phone using an other phone's hotspot and the hotspot of the phone.



      On the phone having its hotspot turned on, I am using this code to compute the data usage of the hotspot(The result is display on a TextView (TextView) findViewById(R.id.data_seller)). I named this phone the server phone:



      private void getNetworkStatsServer() {
      NetworkStatsManager networkStatsManager;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      networkStatsManager = getApplicationContext().getSystemService(NetworkStatsManager.class);
      NetworkStats networkStatsWifi = null;
      NetworkStats networkStatsMobile = null;
      try {
      Calendar calendar = Calendar.getInstance();
      calendar.add(Calendar.DATE, 1);
      if (networkStatsManager != null) {
      networkStatsWifi = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,
      "", 0, calendar.getTimeInMillis(), UID_TETHERING);
      String suscribeId = "";
      TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
      if (tm != null) {
      suscribeId = tm.getSubscriberId();
      }
      networkStatsMobile = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
      suscribeId, 0, calendar.getTimeInMillis(), UID_TETHERING);
      }
      } catch (RemoteException e) {
      e.printStackTrace();
      }
      NetworkStats.Bucket bucket;

      if (networkStatsWifi != null) {
      while (networkStatsWifi.hasNextBucket()) {
      bucket = new NetworkStats.Bucket();
      networkStatsWifi.getNextBucket(bucket);
      mStartTXServer += bucket.getTxBytes();
      mStartRXServer += bucket.getRxBytes();
      }
      }

      if (networkStatsMobile != null) {
      while (networkStatsMobile.hasNextBucket()) {
      bucket = new NetworkStats.Bucket();
      networkStatsMobile.getNextBucket(bucket);
      mStartTXServer += bucket.getTxBytes();
      mStartRXServer += bucket.getRxBytes();
      }
      }
      }
      mHandler.postDelayed(mRunnableServer, 1000);
      }

      mRunnableServer = new Runnable() {
      public void run() {
      long res = new long[2];
      NetworkStatsManager networkStatsManager;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      networkStatsManager = getApplicationContext().getSystemService(NetworkStatsManager.class);
      NetworkStats networkStatsWifi = null;
      NetworkStats networkStatsMobile = null;
      try {
      Calendar calendar = Calendar.getInstance();
      calendar.add(Calendar.DATE, 1);
      if (networkStatsManager != null) {
      networkStatsWifi = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_WIFI,
      "", 0, calendar.getTimeInMillis(), UID_TETHERING);
      networkStatsMobile = networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
      "", 0, calendar.getTimeInMillis(), UID_TETHERING);
      }
      } catch (RemoteException e) {
      e.printStackTrace();
      }
      NetworkStats.Bucket bucket;

      if (networkStatsWifi != null) {
      while (networkStatsWifi.hasNextBucket()) {
      bucket = new NetworkStats.Bucket();
      networkStatsWifi.getNextBucket(bucket);
      res[0] += bucket.getTxBytes();
      res[1] += bucket.getRxBytes();
      }
      }
      if (networkStatsMobile != null) {
      while (networkStatsMobile.hasNextBucket()) {
      bucket = new NetworkStats.Bucket();
      networkStatsMobile.getNextBucket(bucket);
      res[0] += bucket.getTxBytes();
      res[1] += bucket.getRxBytes();
      }
      }
      if (networkStatsMobile != null || networkStatsWifi != null) {
      res[0] -= mStartTXServer;
      res[1] -= mStartRXServer;
      }
      } else {
      res[0] = TrafficStats.getUidTxBytes(UID_TETHERING) - mStartTXServer;
      res[1] = TrafficStats.getUidRxBytes(UID_TETHERING) - mStartRXServer;
      }

      System.out.println("Value of Rx: " + res[0]);
      System.out.println("Value of Tx: " + res[1]);

      ((TextView) findViewById(R.id.data_seller)).setText(String.valueOf(((double) (res[0] + res[1])) / 1048576) + "MB");
      mHandler.postDelayed(mRunnableServer, 10000);
      }
      };


      Concerning the phone using the hotspot to be connected on internet, I compute the total data usage of the Wifi.I named this phone the client phone



      private void getNetworkStatsClient() {
      mStartTXClient = TrafficStats.getTotalTxBytes();
      mStartRXClient = TrafficStats.getTotalRxBytes();

      mHandler.postDelayed(mRunnableClient, 1000);
      }

      mRunnableClient = new Runnable() {
      public void run() {
      long res = new long[2];
      res[0] = TrafficStats.getTotalTxBytes() - mStartTXClient;
      res[1] = TrafficStats.getTotalRxBytes() - mStartRXClient;

      System.out.println("Value of Rx: " + res[0]);
      System.out.println("Value of Tx: " + res[1]);

      ((TextView) findViewById(R.id.data_buyer)).setText(String.valueOf(((double) (res[0] + res[1])) / 1048576) + "MB");
      mHandler.postDelayed(mRunnableClient, 10000);
      }
      };


      I thought the result of both would have been more or less the same (More precisely, res[0]+res[1] in both runnable would have been more or less equal) because the client phone is using the server hotspot phone. However, the results are totally different (The data usage of the client phone is 50 times greater than the server phone).
      Do you have an idea why?







      android networkstatsmanager android-trafficstats






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 17 at 14:40









      Adrien Boukobza

      968




      968
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Let me try to rephrase.



          Set up: You have an AP and some Users. That is regular tethering.



          Goal: You want to measure the data/bandwidth usage. I.e., how much data did the Users suck.



          Experiment: You try to measure this usage on the AP side as well as on the User's side.



          Observation: You are surprised to see that what you measure on the AP side is not the same as what you measure on the Users side.



          Potential investigation strategy:



          I see you have and if-else depending on the SDK version. Say that when experimenting, your AP is always the same device, and the User is always another device, then each side uses may use a different API.



          Have you tried running your code on two devices that have the same SDK, and will therefore use the same API? This isn't an answer, but it might be informative.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352247%2fandroid-difference-between-data-usage-on-a-hotspot-phone-and-on-a-phone-using-i%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            Let me try to rephrase.



            Set up: You have an AP and some Users. That is regular tethering.



            Goal: You want to measure the data/bandwidth usage. I.e., how much data did the Users suck.



            Experiment: You try to measure this usage on the AP side as well as on the User's side.



            Observation: You are surprised to see that what you measure on the AP side is not the same as what you measure on the Users side.



            Potential investigation strategy:



            I see you have and if-else depending on the SDK version. Say that when experimenting, your AP is always the same device, and the User is always another device, then each side uses may use a different API.



            Have you tried running your code on two devices that have the same SDK, and will therefore use the same API? This isn't an answer, but it might be informative.






            share|improve this answer

























              up vote
              0
              down vote













              Let me try to rephrase.



              Set up: You have an AP and some Users. That is regular tethering.



              Goal: You want to measure the data/bandwidth usage. I.e., how much data did the Users suck.



              Experiment: You try to measure this usage on the AP side as well as on the User's side.



              Observation: You are surprised to see that what you measure on the AP side is not the same as what you measure on the Users side.



              Potential investigation strategy:



              I see you have and if-else depending on the SDK version. Say that when experimenting, your AP is always the same device, and the User is always another device, then each side uses may use a different API.



              Have you tried running your code on two devices that have the same SDK, and will therefore use the same API? This isn't an answer, but it might be informative.






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                Let me try to rephrase.



                Set up: You have an AP and some Users. That is regular tethering.



                Goal: You want to measure the data/bandwidth usage. I.e., how much data did the Users suck.



                Experiment: You try to measure this usage on the AP side as well as on the User's side.



                Observation: You are surprised to see that what you measure on the AP side is not the same as what you measure on the Users side.



                Potential investigation strategy:



                I see you have and if-else depending on the SDK version. Say that when experimenting, your AP is always the same device, and the User is always another device, then each side uses may use a different API.



                Have you tried running your code on two devices that have the same SDK, and will therefore use the same API? This isn't an answer, but it might be informative.






                share|improve this answer












                Let me try to rephrase.



                Set up: You have an AP and some Users. That is regular tethering.



                Goal: You want to measure the data/bandwidth usage. I.e., how much data did the Users suck.



                Experiment: You try to measure this usage on the AP side as well as on the User's side.



                Observation: You are surprised to see that what you measure on the AP side is not the same as what you measure on the Users side.



                Potential investigation strategy:



                I see you have and if-else depending on the SDK version. Say that when experimenting, your AP is always the same device, and the User is always another device, then each side uses may use a different API.



                Have you tried running your code on two devices that have the same SDK, and will therefore use the same API? This isn't an answer, but it might be informative.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered yesterday









                hartmut

                378114




                378114






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53352247%2fandroid-difference-between-data-usage-on-a-hotspot-phone-and-on-a-phone-using-i%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin