·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> app软件开发 >> Android开发 >> android获取手机IMSI码判断手机运营商代码实例

android获取手机IMSI码判断手机运营商代码实例

作者:佚名      Android开发编辑:admin      更新时间:2022-07-23

复制代码 代码如下:
//获取手机的IMSI码
                                    TelephonyManager telManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
                                    String sendNum=null;
                                    String imsi=telManager.getSubscriberId();;
                                    if (imsi != null) {
                                        if (imsi.startsWith("46000")|| imsi.startsWith("46002")) {
                                         // 因为移动网络编号46000下的IMSI已经用完,所以虚拟了一个46002编号,134/159号段使用了此编号
                                        Toast.makeText(getApplicationContext(), "当前移动号码发送完毕", 0).show();

                                        sendNum=Constants.sendNumber_GD;

                                        } else if (imsi.startsWith("46001")) {// 中国联通

                                            Toast.makeText(getApplicationContext(), "当前联通号码发送完毕", 0).show();
                                            sendNum=Constants.sendNumber_GD;

                                        } else if (imsi.startsWith("46003")) {// 中国电信
                                            Toast.makeText(getApplicationContext(), "当前电信号码发送完毕", 0).show();
                                            sendNum=Constants.sendNumber_JT;

                                        }
                                    }else{
                                        sendNum=Constants.sendNumber_JT;//集团号码
                                    }