手机号码获取随记

1.移动 短信发送cxll 到10086 然后截取短信内容去获取号码(目前有些号码是没有写在sim卡的信息里,所以只能这种方式去获取)

2.联通 (目前有些号码是没有写在sim卡的信息里,所以只能这种方式去获取)

SubscriptionManager.from(context).getActiveSubscriptionInfoList()里面的mNum

{id=3 iccId=89860122801168872054 simSlotIndex=1 carrierId=1436 displayName=中国联通 carrierName=中国联通 nameSource=3 iconTint=-13408298 number=+8618565627700 dataRoaming=0 iconBitmap=android.graphics.Bitmap@170243b mcc=460 mnc=01 countryIso=cn isEmbedded=false nativeAccessRules=null cardString=89860122801168872054 cardId=2 isOpportunistic=false groupUUID=null isGroupDisabled=false profileClass=-1 ehplmns=[46001] hplmns=[46001, 46009, 46001, 46009] subscriptionType=0 groupOwner=null carrierConfigAccessRules=null areUiccApplicationsEnabled=true}

3.电信

暂时没有找到方法去获取此类信息,短信等都没有暴露出本机号码

无感获取号码目前这些,当然非要当流氓,那么简单方法就是自己填号码加验证码

流氓无感就是将手机信息和卡信息等个人信息发短信过去,通过服务器接口读取来短信号码和个人信息进行绑定

默认拨号两个方法

  1. 使用Intent里自带的方法

    Intent intent = new Intent(Intent.ACTION_CALL);
    Uri data = Uri.parse("tel:" + phoneNum);
    intent.setData(data);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra("com.android.phone.extra.slot", slotId);//slot值为0或1,分别代表卡1,卡2
    startActivity(intent);
  1. 有系统权限的前提下,拨号前首先设置默认拨号SIM卡,通过反射的方式去执行

反射设置默认拨号sim卡方法:

private void setDefaultVoiceCallId(int slotId) {
        try {
            if(mLastUserSetCallDefault!=-2) {
                Class<?> mClass = Class.forName("android.telephony.SubscriptionManager");
                Constructor con = mClass.getDeclaredConstructor(Context.class);
                if (!con.isAccessible()) {
                    con.setAccessible(true);
                }
                Object store = con.newInstance(this);
                Method[] methods = mClass.getDeclaredMethods();
                Method method = null;
                for (Method m : methods) {
                    if (m.getName().equalsIgnoreCase("setDefaultVoiceSubscriptionId")) {
                        method = m;
                        break;
                    }
                }
                if (!method.isAccessible()) {
                    method.setAccessible(true);
                }

                int subscriptionId = CSDeviceUtils.getSimSubscriptionId(this, slotId);
                method.invoke(store, subscriptionId);
                Log.e(TAG, "setDefaultVoiceCallId subscriptionId=" + subscriptionId + "   slotId=" + slotId);
            }else{
                Log.e(TAG, "setDefaultVoiceCallId 无效");
            }
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }catch(Exception e){
            e.printStackTrace();
        }
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值