来电显示监听
作者:
勤劳的蚂蚁 | 来源:发表于
2020-03-13 15:39 被阅读0次public class BroadcastReceiverMgr extends BroadcastReceiver {
public void setOnCallComingListener(OnCallComingListener onCallComingListener) {
this.onCallComingListener = onCallComingListener;
}
private OnCallComingListener onCallComingListener;
@Override
public void onReceive(Context context, Intent intent) {
//呼入电话
if(intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)){
TelephonyManager manager = (TelephonyManager) context.getSystemService(Service.TELEPHONY_SERVICE);
if (null != onCallComingListener){
onCallComingListener.onCallComing(manager.getCallState());
}
}
}
public interface OnCallComingListener{
void onCallComing(int callState);
}
}
本文标题:来电显示监听
本文链接:https://www.haomeiwen.com/subject/bfelshtx.html
网友评论