@Override
public void register() {
if (telephonyManager != null) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1 && subscriptionManager != null) {
if (networkListener == null) {
int index = 0;
for (SubscriptionInfo info : subscriptionManager.getActiveSubscriptionInfoList()) {
if (info.getSimSlotIndex() > index) {
networkListener = new NetworkListener(info.getSubscriptionId());
index = info.getSimSlotIndex();
}
}
}
}
if (networkListener != null)
telephonyManager.listen(networkListener, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
isRegistered = true;
}
DualNetworkIconData.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:Status
作者:
评论列表
文章目录