sounny

Untitled

Nov 30th, 2018
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. public class PhoneCallReceiver extends BroadcastReceiver {
  2.     @Override
  3.     public void onReceive(Context context, Intent intent) {
  4.         Bundle extras = intent.getExtras();
  5.         if(extras != null){
  6.             String state = extras.getString(TelephonyManager.EXTRA_STATE);
  7.             if(state.equals(TelephonyManager.EXTRA_INCOMING_NUMBER)){
  8.             String phoneNumber = extras.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
  9.             Log.w("DEBUG", phoneNumber);
  10.             }
  11.         }
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment