I am building a call forwarding application and have used the **21*xxxxxx# ussd code to activate call fowarding using ACTION_CALL Intent. But I have not found a solution to check whether Call forwarding is active or not.
Is there any solution to check from the android system if call forwarding is active or not?
 TelephonyManager manager = (TelephonyManager)    
 this.getSystemService(TELEPHONY_SERVICE);     
 manager.listen(new MyPhoneStateListener(), 
 PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR ); 
 class MyPhoneStateListener extends PhoneStateListener{  
  @Override
    public void onCallForwardingIndicatorChanged(boolean cfi) {
      Log.i(TAG,"onCallForwardingIndicatorChanged  CFI ="+cfi);
         preferences.edit().putBoolean("CALL_FORWARD_ACTIVE", cfi).commit();
        super.onCallForwardingIndicatorChanged(cfi);
    }
}
if cfi returns true that means set call forward success
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With