1. Read SIM card information
Private Telephonymanager TM; TM = (Telephonymanager) getsystemservice (Telephony_service); String sim = Tm.getsimserialnumber ();
Requires Telephonymanager and permissions
<uses-permission android:name= "Android.permission.READ_PHONE_STATE"/>
2. Send SMS
Smsmanager Smsmanager = Smsmanager.getdefault (); smsmanager.sendtextmessage (phone, NULL, "MSG!", null, NULL);
Texting permission
<uses-permission android:name= "Android.permission.SEND_SMS"/>
Manager.sendtextmessage (Mobile,null,text,null,null);
First parameter: Phone number of the other person
Second parameter: SMS center number, generally set to empty
Third parameter: SMS content
The fourth parameter: Sentintent determine whether the text message is sent successfully, if you do not have a SIM card, or network interruption, you can use this intent to judge.
Note the emphasis is on whether the "send" action was successful. So as for whether or not the other party received
Fifth parameter: When a text message is sent to the recipient, it receives the deliveryintent. The result of "send" is emphasized.
This means that the two intent of sentintent and deliveryintent are activated when the message is sent successfully and the recipient receives this message. This is also equivalent to delaying the execution of the intent
3. Play Music
Create a music file to use for raw directory copies
Write code to play music:
MediaPlayer MediaPlayer =mediaplayer.create (context, R.raw.ylzs); Mediaplayer.setvolume (1.0f, 1.0f);// Channel mediaplayer.setlooping (FALSE);//Whether the loop plays Mediaplayer.start (); Abortbroadcast ();//4.3 version screen SMS Transceiver
Android small feature realizes-sim card reading, texting, playing music