I tried googling in google but unable to find the answer
Will anyone please let me know, how can i retrieve the current phone number from the android code. I think phone number will be stored in the sim card.
Thanks & Regards, SSuman185
On Android the most common path to finding your number is: Settings > About phone/device > Status/phone identity > Network. This slightly differs on Apple devices, where you can follow the path of Settings > Phone > My Number.
Here's is the USSD code for Airtel, BSNL, Jio, and Vi to look for your mobile number: Airtel- *282# BSNL- *222# Jio- *1#
Navigate to the app > res > layout > activity_main. xml and add the below code to that file. Create a TextView to display the mobile number.
You can also use your phone's settings to find out your phone number. However, the most popular and the easiest method to find out the mobile number from SIM is the dial the USSD code given by the respective network provider for this purpose. Here are the USSD codes of different networks to find out the mobile number.
You can try:
TelephonyManager phoneManager = (TelephonyManager)
getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
String phoneNumber = phoneManager.getLine1Number();
Needs READ_PHONE_STATE
permission.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With