I placed below code in BroadcastReceiver and this code trigger every time when a new call arrives. But bundle not contains incoming_number. By printing out the bundle I get Bundle[{state=RINGING}] as output. and I only get this problem in new phones(>= Android 9.0)
Bundle bundle = intent.getExtras();
System.out.println("Kokp 1:- " + bundle);
String phoneNumber = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
Documentation indicates that
EXTRA_INCOMING_NUMBERis only populated if your app has the following permissions: