How to get the mobile number of current sim card in real device?

前端 未结 6 1593
春和景丽
春和景丽 2020-11-28 03:39

I have to make an application which shows the contact no of the SIM card that is being used in the cell. For that I need to use TelephonyManager class. Can I ge

6条回答
  •  甜味超标
    2020-11-28 04:30

    As many said:

    String phoneNumber = TelephonyManager.getDefault().getLine1Number();
    

    The availability depends strictly on the carrier and the way the number is encoded on the SIM card. If it is hardcoded by the company that makes the SIMs or by the mobile carrier itself. This returns the same as in Settings->about phone.

提交回复
热议问题