How to get caller ID without using CALL_LOG permissions

I'm trying to face the new limitation () by using this solution () and unfortunately the marked code (in blue) always returns null.

Code:

public class CustomBroadcastReceiver extends BroadcastReceiver {

private static final String TAG = "CustomBroadcastReceiver";

@Override public void onReceive(Context context, Intent intent) { Log.v(TAG, "WE ARE INSIDE!!!!!!!!!!!"); TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener();

telephony.listen(customPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);

Bundle bundle = intent.getExtras(); String phoneNr= bundle.getString("incoming_number"); Log.v(TAG, "phoneNr: "+phoneNr); }

According to these new restrictions, my application will be removed from google play store and I will be forced to close my project.
I need an idea of how to get the phone number on a current phone call, don't need to get call log, only the current.

Show Accepted Answer

Guest Quick Reply (No URL, BBcode or HTML)

Last post by king.vita
3 hours ago
Last post by spinka.elinore
10 minutes ago
Last post by kamren98
3 hours ago
Last post by maggie24
3 hours ago
Last post by davis.gussie
2 hours ago