【问题标题】:How to know data usage of mobile for specific sim slot如何知道特定 SIM 卡插槽的移动数据使用情况
【发布时间】:2016-01-07 14:10:51
【问题描述】:

我正在尝试查找特定 sim 插槽的数据使用情况。为此,我使用的是 TrafficStats.getMobileRxBytes() 方法,但它提供了双 sim 卡设备中两个 sim 卡的总使用量。我想要个人 sim 的特定数据使用情况。任何建议将不胜感激。

【问题讨论】:

  • 您看过this question 及其答案吗?
  • 你找到解决办法了吗?

标签: android dual-sim


【解决方案1】:

提示:您可以在 sim slot data active 事件中执行类似操作 TrafficStats.setThreadStatsTag(identifier_tag);

if(TrafficStats.getThreadStatsTag() == SIM1_SLOT){
     int usedBytes = TrafficStats.getMobileRxBytes() 
}else{
    // Sim2 slot
    int usedBytes = TrafficStats.getMobileRxBytes() 
}

【讨论】:

  • 第一个槽和第二个槽总是返回 -1。
猜你喜欢
  • 2017-08-08
  • 2014-03-11
  • 1970-01-01
  • 2013-12-10
  • 1970-01-01
  • 2015-10-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多