尝试截取传出的电话,并有一个解决方案工作良好。
但在三星Galaxy的2.1版上,有人看到了这个吗?
<receiver android:name="com.mypackge.OutGoingCallDetection"
android:exported="true">
<intent-filter>
<action
android:name="android.intent.action.NEW_OUTGOING_CALL"
android:priority="0" />
</intent-filter>
</receiver>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" /> 更新:还添加了PROCESS_OUTGOING_CALLS。
接受者:
public class OutGoingCallDetection extends BroadcastReceiver {
private static final String TAG = "OutGoingCallDetection";
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.d(TAG, "onReceive, Action:" +intent.getAction());
}
}发布于 2014-05-10 02:32:20
我以编程方式创建了广播监听器。效果很好。供你参考。
IntentFilter filter = new IntentFilter();
filter.addAction("android.intent.action.NEW_OUTGOING_CALL");
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.d(TAG, "onReceive, Action:" +intent.getAction());
}
};
registerReceiver(receiver, filter);https://stackoverflow.com/questions/6696652
复制相似问题