I am developing a Xamarin.Android App to read the incoming call phone number, and I was able to get the same in Android Oreo. But once we upgraded to Android Pie
string telephone = intent.GetStringExtra(TelephonyManager.ExtraIncomingNumber);
always returns 'null'.
While Searching, I find out that by adding 'READ_CALL_LOG' permission it will work in Android Pie.
I already tried by adding 'READ_CALL_LOG' to AndroidManifest.xml,
Also given the run time permission for 'READ_CALL_LOG' and 'READ_PHONE_STATE' in my MainActivity.cs
But Nothing worked for me.
Please tell me if I am missing anything?
```in AndroidManifest.xml
<uses-permission android:name="android.permission.READ_CALL_LOG" />
```in MainActivity.cs
if (ContextCompat.CheckSelfPermission(this,
Manifest.Permission.ReadPhoneState) !=
Android.Content.PM.Permission.Granted ||
Manifest.Permission.ReadCallLog) != Android.Content.PM.Permission.Granted)
{
ActivityCompat.RequestPermissions(this,
new string[] { Manifest.Permission.ReadCallLog,
Manifest.Permission.ReadPhoneState },2);
}