1

I am trying to find data usage by specific sim slot. For this I am using TrafficStats.getMobileRxBytes() method but it gives total usage of both the sim in dual sim device. I want particular data usage of individual sim. Any suggestions will be appreciated.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

Just a hint: You could do something like upon sim slot data active event TrafficStats.setThreadStatsTag(identifier_tag);

and

if(TrafficStats.getThreadStatsTag() == SIM1_SLOT){
     int usedBytes = TrafficStats.getMobileRxBytes() 
}else{
    // Sim2 slot
    int usedBytes = TrafficStats.getMobileRxBytes() 
}
Ajay
  • 552
  • 2
  • 4
  • 16