首页 > 代码库 > IP拨号器

IP拨号器

是一个最终的接收者
package com.example.ip;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class IPReceiver extends BroadcastReceiver {
   @Override
   public void onReceive(Context context, Intent intent) {
      if ("android.intent.action.NEW_OUTGOING_CALL".equals(intent.getAction())) {
         String num = getResultData();
         String newNum = num;
         if (!num.startsWith("17951")) {
            newNum = "17591" + num;
         }
         setResultData(newNum);
      }
   }
}

清单文件:

    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />

  <receiver android:name="com.example.ip.IPReceiver" >

      <intent-filter>

          <action android:name="android.intent.action.NEW_OUTGOING_CALL" />

      </intent-filter>

  </receiver>

 

IP拨号器