欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

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

程序员文章站 2023-11-18 12:16:40
复制代码 代码如下://获取手机的imsi码          &nbs...

复制代码 代码如下:

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