Incoming phone number Android 12

How to get incoming phone number on Android 12?

  • android.telecom.CallScreeningService is not working (all found examples proofed, failed) :cry:
  • RoleManager.ROLE_CALL_SCREENING disabled TelephonyCallback.CallStateListener :crazy_face:
  • IntentFilter(ā€œandroid.intent.action.PHONE_STATEā€) works, but without income phone number :face_with_head_bandage:

I have only 2 stupid choices:

a)

  • watch directory ā€œrecordings/callā€ or ā€œcallā€
  • if file created, this must be call file ####_number/name_date_time.m4a
  • now I can extract number/name
  • if name given, look up into contacts

b)

  • end of call (TelephonyManager.CALL_STATE_OFFHOOK) read call log
String[] projection = new String[]{Calls.NUMBER};
Cursor cur = getContentResolver().query(Calls.CONTENT_URI, projection, null, null, Calls.DATE +" desc");
cur.moveToFirst();
String lastCallnumber = cur.getString(0);

I miss old Android 10. How to access income number right now in Android12 and further?

Do the APIs you’ve mentioned work in other mobiles?

Same issue on other mobile phones (Samsung, LG).

Android 11,12,13+ does not support fetching phone number after ringing.

You have to wait until call file is written in /call folder, please check also /storage/emulated/0/recordings/call. Here you can extract the phone number from file name.
After hangup you can look up the phone call log.
The callscreeningservice is not an option.
With each new android version there are more and more limitations for third party developer.

If the issue exists on other mobile phones, I think this is an issue with android as you already mentioned.

1 Like