I used nokia 6 which is android 8.1.0 . i used this code for finding my phone number
TelephonyManager tel= (TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
String PhoneNumber = tel.getLine1Number();
Toast.makeText(getApplicationContext(), PhoneNumber ,Toast.LENGTH_LONG).show();
but it return empty (""). on an other hand it's work fine my emulator.
Please any one help me for this oreo solution.
In AndroidManifest.xml, give the following permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>