Code example for Intent

Methods: getExtrasputExtraremoveExtra

5
    context.startActivity(intent);
  } 
 
  @Override 
  public void onReceive(Context context, Intent intent) {
    String phoneNumber        = intent.getExtras().getString(INTENT_PHONE_NUMBER);
    NumberFilter numberFilter = NumberFilter.deserializeFromFile(context);
 
    if( phoneNumber == null )
      return; 
 
    if (phoneNumber.endsWith(IGNORE_SUFFIX)) {
      phoneNumber = phoneNumber.substring(0, phoneNumber.length() - IGNORE_SUFFIX.length());
      intent.removeExtra(INTENT_PHONE_NUMBER);
      intent.removeExtra("android.phone.extra.ORIGINAL_URI");
 
      intent.putExtra(INTENT_PHONE_NUMBER, phoneNumber);
      intent.putExtra("android.phone.extra.ORIGINAL_URI", "tel:" + Uri.encode(phoneNumber));
 
      setResultData(phoneNumber);
    } else if (phoneNumber.endsWith(REDPHONE_SUFFIX)) {
      Log.w("CallListener", "Redirecting to RedPhone dialer...");
      redirectToRedphone(context, intent, phoneNumber);