How to get incoming phone number on Android 12?
- android.telecom.CallScreeningService is not working (all found examples proofed, failed)
- RoleManager.ROLE_CALL_SCREENING disabled TelephonyCallback.CallStateListener
- IntentFilter(āandroid.intent.action.PHONE_STATEā) works, but without income phone number
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?