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.
Asked
Active
Viewed 631 times
1
-
Have you looked at [this question](http://stackoverflow.com/questions/11305407/android-dual-sim-card-api) and its answers? – ashes999 Jan 07 '16 at 16:11
-
did you find any solution ? – Manohar Sep 28 '18 at 09:27
1 Answers
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
-
always returns -1 for both first slot as well as for second slot. – Anil Kumar Jha May 31 '16 at 09:57