In general, the Android phone does not have missed calls to the listener, if you want to achieve the processing of missed calls, you need to write their own programs to achieve. The program example described in this paper is the Android implementation to judge the phone missed calls and processing methods. It is mainly divided into four steps:
1, the preparation of calllistener, processing mobile phone status change monitoring, when the state changes to deal with:
Package Rbase.app.smshelpmate.call.listener;
Import Java.text.MessageFormat;
Import Rbase.app.smshelpmate.Config;
Import RBASE.APP.SMSHELPMATE.R;
Import Rbase.app.smshelpmate.call.enums.CallStateEnum;
Import Rbase.app.smshelpmate.forward.ForwardManager;
Import Rbase.app.smshelpmate.forward.enums.ForwardType;
Import Rbase.app.smshelpmate.forward.vo.ForwardParam;
Import Android.content.Context;
Import Android.telephony.PhoneStateListener;
Import Android.telephony.TelephonyManager;
Import Android.util.Log; public class Calllistener extends Phonestatelistener {private static final String TAG = "SMS"; private static int lastets Tate = Telephonymanager.call_state_idle;
The final state is private context; Public Calllistener {super (); this.context = context;} public void oncallstatechanged (int state, String
Incomingnumber) {log.v (TAG, "Calllistener called State changed:" + Incomingnumber);
String m = null; If the current state is idle and the last status is Bell, it is considered to be a missed call if (Lastetstate = Telephonymanager.call_state_ringing && state = = Telephonymanager.call_state_idle) {sendsmgwhenmissedcall (incomingnumber);}//
Finally, change the current value lastetstate = state;
} private void Sendsmgwhenmissedcall (String incomingnumber) {//Missed calls processing (texting, emailing, etc.)}
2, write callreceiver, registered caller radio receiver:
package rbase.app.smshelpmate.call.service; import Rbase.app.smshelpmate.Const;
Import Rbase.app.smshelpmate.call.listener.CallListener;
Import Android.content.BroadcastReceiver;
Import Android.content.Context;
Import android.content.Intent;
Import Android.os.Bundle;
Import Android.telephony.PhoneStateListener;
Import Android.telephony.TelephonyManager;
Import Android.util.Log; The public class Callreceiver extends broadcastreceiver{the public void onreceive (context, Intent Intent) {log.i ("SMS"),
"Callreceiver Start ...");
Telephonymanager telephony = (telephonymanager) context. Getsystemservice (Context.telephony_service);
Calllistener Customphonelistener = new Calllistener (context);
Telephony.listen (Customphonelistener, phonestatelistener.listen_call_state);
Bundle Bundle = Intent.getextras ();
String Phonenr = bundle.getstring ("Incoming_number"); LOG.I ("SMS", "Callreceiver Phone Number:" + Phonenr);}}
3, in the Androidmanifest.xml in the application node registered phone status change broadcast reception:
<manifest ...>
<application ...>
<receiver android:name= ". Call.service.CallReceiver" >
<intent-filter android:priority= ">
<action android:name=" Android.intent.action.PHONE_STATE "/>
</intent-filter>
</receiver>
</application>
</manifest>
4, in the Androidmanifest.xml to add read the status of the mobile phone permissions:
<uses-permission android:name= "Android.permission.READ_PHONE_STATE"/>
Through the above steps, when the phone has missed calls Sendsmgwhenmissedcall this method will trigger, you can do the corresponding processing.