Get Mobile no from real device

前端 未结 3 1890
孤城傲影
孤城傲影 2021-01-05 06:50

I want to get the mobile number of a sim which is inserted into the device. I know as pr the android SDK TelephoneManger is the class by which we can get it by

相关标签:
3条回答
  • 2021-01-05 07:09

    You are using correct and the only approach available to the common user (AFAIK). It is mainly SIM dependent (it is not obligatory to have ), and in some cases may be device dependent (getLine1Number() not correctly implemented).

    To be more precise, IMSI uniquely identifies SIM. But MSISDN (the subscriber number) is not uniquely related to SIM, as it is possible to change MSISDN on the SIM. Network may use IMSI from SIM to find MSISDN in the HLR and establish the call.

    So, MSISDN is not mandatory to be on the SIM.

    0 讨论(0)
  • 2021-01-05 07:09

    In that case you always save your phone no using SharedPreference by using the method getLine1Number() method. when you install your application then your phone number is saven and when when new sim card is used then send SMS to ur registered number. you have to always check after starting the application that your stored number is same with your new number.if same nothing will be happned ,if not same then ur app will send SMS.

    0 讨论(0)
  • 2021-01-05 07:28

    You should look at this question and its comments.

    Some SIM cards seems to cause getLine1Number() to return null... and no one has found a way to deal with this.

    More information here

    0 讨论(0)
提交回复
热议问题