`
海布里的味道
  • 浏览: 18941 次
  • 性别: Icon_minigender_1
  • 来自: 南京
文章分类
社区版块
存档分类
最新评论

关于呼叫转移的知识点

阅读更多

摘自各论坛网友的回答

 

1、移动和联通

功 能                设 置                                                取 消        查 询
无条件转移        **21*电话号码#                                ##21#        *#21#
无信号转移         **62*电话号码#                                ##62#        *#62#
无应答转移        **61*电话号码*10*响铃时间#        ##61#        *#61#
遇忙转移                **67#电话号码#                                ##67#        *#67#


2、

之前在Windows Mobile上实现过“电话已关机”,“此号码已停机”等,是用的来电转移实现的,现在需要在Android上实现,发现360手机安全卫士for Android 也是通过来电转移实现的,尝试了下,代码如下:

 

  1. //13800000000即是要转移到的号码  
  2. Intent localIntent = new Intent();  
  3. localIntent.setAction("android.intent.action.CALL");  
  4. Uri uri = Uri.parse("tel:" + "**67*13800000000%23");  
  5. localIntent.setData(uri);  
  6. startActivity(localIntent);   

 

以下号码供参考:

返回空号的提示音:**67#13800000000#   或者 **67#13444444444#
返回暂时无法接通:**67#13642952697#
返回停机的提示音:**67#13701110216#
返回电话号码有误:**67#13800516309#
返回电话号码关机:**67#13810538911#

转移还有以下方式

1、无条件呼叫转移: 激活方式**21*号码# , 取消方式##21# , 查询方式 *#21# ; ! [6 ~# a; [3 X) u" X) r8 Y4 d
2、 遇忙呼叫转移: 激活方式**67*号码# , 取消方式##67# , 查询方式 *#67# ; 
3、 无应答呼叫转移: 激活方式**61*号码# , 取消方式##61# , 查询方式*#61# ; 
不可及呼叫转移: 激活方式**62*号码# , 取消方式##62# , 查询方式 *#62# .

 

所以取消呼叫转移的代码如下

 

  1. Intent localIntent = new Intent();  
  2. localIntent.setAction("android.intent.action.CALL");  
  3. Uri uri = Uri.parse("tel:" + "%23%2367%23");  
  4. localIntent.setData(uri);  
  5. startActivity(localIntent);   

 

注意:"#" 必须用 "%23“代替

3、中国电信

 

名称 开通方式 取消方式 类型说明
遇忙转移 *90+要转移的号码+发送 *900发送 指正在通话使用时触发转移
无应答或
关机转移
*92+要转移的号码+发送 *920发送 指久叫无应答、关机及无信号时触发转移
无条件转移 *72+要转移的号码+发送 *720发送 指在任何情况下都自动呼转
默认前转
(缺省转移)
*68+要转移的号码+发送 *680发送 指关机、无信号、无应答或遇忙时被叫触发转移
包括前三种
条件转移
  *730发送 包括前三种条件转移
说明:
1、如转移到固定电话,需加长途区号。
2、 拨打*730无法取消默认前转。
3、 建议设置完呼转后要测试是否成功。

4、

public class SettingActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener{

        private ITelephony iTelephony;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        // Load the preferences from an XML resource
        addPreferencesFromResource(R.xml.preferences);
        
       PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).registerOnSharedPreferenceChangeListener(this);//registerOnSharedPreferenceChangeListener(this);
   
       mPhoneCallListener phoneListener=new mPhoneCallListener();

       TelephonyManager telMgr = (TelephonyManager)getSystemService(
           TELEPHONY_SERVICE);
     //初始化iTelephony
       Class <TelephonyManager> c = TelephonyManager.class;
       Method getITelephonyMethod = null;
       try {
             getITelephonyMethod = c.getDeclaredMethod("getITelephony", (Class[])null);
             getITelephonyMethod.setAccessible(true);
       } catch (SecurityException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       } catch (NoSuchMethodException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }

       try {
       iTelephony = (ITelephony) getITelephonyMethod.invoke(telMgr, (Object[])null);
       } catch (IllegalArgumentException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       } catch (IllegalAccessException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       } catch (InvocationTargetException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
      
       telMgr.listen(phoneListener, mPhoneCallListener.
                    LISTEN_CALL_STATE);
    }
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key) {
            getPreferenceScreen().findPreference("incall_end_mode_pre").setSummary(getPreferenceScreen().getSharedPreferences().getString("incall_end_mode_pre", ""));
            Log.d("mode", "XYZ"+getPreferenceScreen().getSharedPreferences().getString("incall_end_mode_pre", ""));
            String str1 = "tel:";
        String str2 = "%23%2367%23";
        String str3 = "**67*13800000000%23";
        String str4 = "**67*13810538911%23";
        String str5 = "**67*13701110216%23";
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);//  
        if(tm.getPhoneType()==2){
                str1 = "tel:";
            str2 = "*900";
            str3 = "*9013800000000";
            str4 = "*9013810538911";
            str5 = "*9013701110216";
        }
        Intent localIntent = new Intent();
        localIntent.setAction("android.intent.action.CALL");
        String mode=getPreferenceScreen().getSharedPreferences().getString("incall_end_mode_pre", "");
       if(mode.equals("空号")){
                Uri localUri1 = Uri.parse(str1 + str3);
            localIntent.setData(localUri1);
            startActivity(localIntent);
        }else if(mode.equals("关机")){
                Uri localUri1 = Uri.parse(str1 + str4);
            localIntent.setData(localUri1);
            startActivity(localIntent);
        }else if(mode.equals("停机")){
                Uri localUri1 = Uri.parse(str1 + str5);
            localIntent.setData(localUri1);
            startActivity(localIntent);
        }else{
                Uri localUri1 = Uri.parse(str1 + str2);
            localIntent.setData(localUri1);
            startActivity(localIntent);
        }
    }
   
   
    public class mPhoneCallListener extends PhoneStateListener
    {
      @Override
      public void onCallStateChanged(int state, String incomingNumber)
      {
        // TODO Auto-generated method stub
        switch(state)  
        {  
        
          case TelephonyManager.CALL_STATE_IDLE:

            break;
            
        
          case TelephonyManager.CALL_STATE_OFFHOOK:

            break;
            
        
          case TelephonyManager.CALL_STATE_RINGING:
      
           
           
     
            {                 
            try
            {            

              iTelephony.endCall();
            
            }
            catch(Exception e)
            {
           
             e.printStackTrace();         
            break;
            }      
          }
        }
        
        super.onCallStateChanged(state, incomingNumber);
        
     
      }
    }
   
}
4、类似软件

融讯通 for Android

联运助手

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics