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>

 

posted on 2017-02-19 16:08  LoaderMan  阅读(179)  评论(0编辑  收藏  举报

导航