首页 > 系统 > Android > 正文

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

2020-04-11 11:59:19
字体:
来源:转载
供稿:网友

复制代码 代码如下:

//获取手机的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;//集团号码
                                    }

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表