title: Why doesn't this code work on android 6 marshmallow Api 23?
body: <p>Why doesn't this code work on android 6 marshmallow Api 23? It does not throw an Exception but the code within callStateListener does not work.</p>
  
  <pre><code>TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
  PhoneStateListener callStateListener = new PhoneStateListener() {
      @Override
      public void onCallStateChanged(int state, String incomingNumber) {
          //if(logAtive) Log.i(LOG_TAG,incomingNumber + " " + state);
          if(state==TelephonyManager.CALL_STATE_RINGING){
              Toast.makeText(getApplicationContext(),"Hey, receive your call. Phone is ringing.",
                      Toast.LENGTH_LONG).show();
          }
          if(state==TelephonyManager.CALL_STATE_OFFHOOK){
              Toast.makeText(getApplicationContext(),"You are in a call. ",
                      Toast.LENGTH_LONG).show();
          }
          if(state==TelephonyManager.CALL_STATE_IDLE){
              Toast.makeText(getApplicationContext(),"You are in idle state… ",
                      Toast.LENGTH_LONG).show();
          }
      }
  };
  
  telephonyManager.listen(callStateListener, PhoneStateListener.LISTEN_CALL_STATE);
  </code></pre>
  
  <p>Permissions:</p>
  
  <pre><code>&lt;uses-feature android:name="android.hardware.telephony" android:required="true" /&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.MODIFY_PHONE_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt;
  &lt;uses-permission android:name="android.permission.PROCESS_INCOMING_CALLS" /&gt;
  </code></pre>
  
  <p>It works perfectly in Android 5.1.1 but not in 6 (API Level 23)</p>