4

I'm trying to work with PreciseCallState in API 22 project using Android Studio. There is an example on SO -

public class OutCallLogger extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    switch (intent.getIntExtra(TelephonyManager.EXTRA_FOREGROUND_CALL_STATE, -2) {
        case PreciseCallState.PRECISE_CALL_STATE_IDLE:
            Log.d(This.LOG_TAG, "IDLE");
            break;
        case PreciseCallState.PRECISE_CALL_STATE_DIALING:
            Log.d(This.LOG_TAG, "DIALING");
            break;
        case PreciseCallState.PRECISE_CALL_STATE_ALERTING:
            Log.d(This.LOG_TAG, "ALERTING");
            break;
        case PreciseCallState.PRECISE_CALL_STATE_ACTIVE:
            Log.d(This.LOG_TAG, "ACTIVE");
            break;
    }
}

}

But it gives error - cannot find symbol variable EXTRA_FOREGROUND_CALL_STATE. What I am missing here? I am a new comer in android world.

Community
  • 1
  • 1
s.k.paul
  • 7,099
  • 28
  • 93
  • 168
  • You need to either use Reflection or a custom android.jar - see here: http://stackoverflow.com/questions/13134331/cannot-detect-when-outgoing-call-is-answered-in-android – Kozuch Feb 15 '17 at 14:14

0 Answers0