DualNetworkIconData.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:Status 作者:
@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;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号