Monitoring of phone Status:
/*** * Inherit the Phonestatelistener class, we can once again its internal various monitoring methods and then through the mobile phone state changes, the system itself to trigger these methods to achieve the function we want */class Myphonestatelistener Extends Phonestatelistener {@Overridepublic void oncallstatechanged (int state, String incomingnumber) {switch (state) { Case TELEPHONYMANAGER.CALL_STATE_IDLE:LOG.V (tag, "spare status"); Break;case TELEPHONYMANAGER.CALL_STATE_RINGING:LOG.V (tag , "The phone rang, the caller number:" + incomingnumber); break;case telephonymanager.call_state_offhook:log.v (Tag, "call status"); Break;default: break;} Super.oncallstatechanged (state, Incomingnumber);}}
Send SMS:
Send SMS Smsmanager = Smsmanager.getdefault (); Pendingintent pintent = pendingintent.getbroadcast (shopdealactivity.this, 0, New Intent (), 0); Smsmanager.sendtextmessage ("10086", NULL, msg_string,pintent, NULL); Toast.maketext (context, "SMS Sent", Toast.length_short). Show ();
Monitoring of Android phone status