title: Getting the caller ID in Android 9
body: <p>I have been using the following code in a <code>BroadcastReceiver</code> to get 
  the caller ID of incoming calls:</p>
  
  <pre><code>@Override
  public void onReceive(Context aContext, Intent aIntent) {
     String action = aIntent.getAction();
  
     if (action==null) return;
     if (!action.equals("android.intent.action.PHONE_STATE")) return;
  
     String curState = aIntent.getStringExtra(TelephonyManager.EXTRA_STATE);
  
     if ((TelephonyManager.EXTRA_STATE_RINGING.equals(curState))
        &amp;&amp;(TelephonyManager.EXTRA_STATE_IDLE.equals(oldState)))){
        String incNumber = aIntent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
  
        // do something here
     }
     oldState=curState;
  }
  </code></pre>
  
  <p>Unfortunately this has stopped working in <code>Android 9.0 (API 28)</code>. More specifically, 
  <code>aIntent.getStringExtra(EXTRA_INCOMING_NUMBER)</code> always returns null. In android <code>versions&lt;=API 27</code> everything works correctly</p>
  
  <p>I have also added the <code>READ_PHONE_STATE</code> and <code>READ_CALL_LOG</code> permissions in the manifest file. </p>
  
  <p>Any ideas? Anybody else experiencing the same problem? </p>
  
  <p>Thanks in advance for your help. </p>