Alibabacloud.com offers a wide variety of articles about block sms messages on android, easily find your block sms messages on android information here online.
(Intent.getaction (). Equals ("Android.provider.Telephony.SMS_RECEIVED")){Cancel the broadcast (this line of code will keep the system from receiving text messages)Abortbroadcast ();StringBuilder sb = new StringBuilder ();Receive data sent by SMSBundle bundle = Intent.getextras ();Determine if there is dataif (bundle! = null){Receive all SMS messages via PDUsObj
1. Initialization
Call the GSMPhone constructor when the mobile phone is started.
GSMPhone (Context context, CommandsInterface ci, PhoneNotifier notifier, boolean unitTestMode)
Create mSMS = new GsmSMSDispatcher (this );
This class inherits from SMSDispatcher. The constructor in the SMSDispatcher class initializes messages of short messages.
MCm. setOnNewSMS (this, EVENT_NEW_SMS, null );
MCm. setOnSmsStatus
Long-winded: I found my blog was reposted, but I didn't specify the source. It felt a little painful and happy. Here we formally declare: reprinted, please indicate the source, thank you. If you have commercial purposes, please be sure to inform me.
The SMS function on Android is basically stable and rarely maintained, so it is always unfamiliar. % >_Let's talk about the smsmanager class:According to the s
Android System SMS Source Library Click to open the linkAndroid System SMS Source Click to open the linkThe new project needs to do the SMS module function, this SMS module non-android system
Some of the related exercises for SMS in Android. I see an article below I will be from the title of the three aspects of the SMS operation in the Android system to a simple learning.SMS Send:Because of the good encapsulation of the method of sending SMS in
Modify the SMS database to generate text messages sent by any phone number.Androidmanifest.xmlXML version= "1.0" encoding= "Utf-8"?>Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.dudon.fakesms"> uses-permissionAndroid:name= "Android.permission.READ_SMS" /> uses-permissionAndroid:name= "Android.permission.WRITE_SMS"
First: Call the system SMS interface to send text messages directly; The main code is as follows:/*** Direct SMS Interface Text message * *@paramPhoneNumber *@parammessage*/ Public voidsendsms (String phonenumber, String message) {//Get SMS ManagerAndroid.telephony.SmsManager Smsmanager =Android.telephony.SmsManage
Sending and receiving text messages should be one of the most basic features of every cell phone, even if the old phone many years ago will have this feature, and Android as an excellent smartphone operating system, naturally, there is no support in this regard. Today we start by creating a simple app that sends and receives text messages.Directory Navigation
Receive
. Event_get_verification_code) {Toast.maketext (Getapplicationcontext (), "Authenticode sent", Toast.length_short). Show ();} else {((throwable) data). Printstacktrace ();}}}}; @Overrideprotected void OnDestroy () {Super.ondestroy ();//this.unregisterreceiver (Smsbroadcastreceiver); Smssdk.unregisteralleventhandler ();}Summary At this point, a text verification function has been implemented. The platform has some limitations and the app must be networked. The verification code can only be 4 bits
There is no formal content provider available for SMS in Android, and no definition is provided in official documents. However, you can still define your own URI, and then query the content of the text. For example, Conetent://sms is the path where all text messages are located.
To classify text
Company to do a "because it is confidential so can not say," The project, there is a need to intercept the mobile phone system text messages, and can not be displayed on the mobile phone text application. OK, at first thought not difficult, on-line check the data also found someone did, so began to write demo, the results only found that this is a big hole ah!! The first online search for the most implementation is the use of custom broadcastreceive
This example for you to share the Android create send and receive SMS application of the simple implementation process for your reference, the specific content as follows
First, receive SMS
The structure of the project is as follows: A simple function of receiving and sending SMS
1. Define a broadcast that receive
phone number, the content of the text message, the time when the text message was sent and received, and the type of the text message.
Main Structure of SMS:
_ Id => short message number, for example, 100
Thread_id => the dialog number, for example, 100
Address => sender address, mobile phone number. For example, + 8613811810000
Person => sender. A number is returned, which is the serial number in the contact list. The stranger isNull
Date =>
Android integrates the call and text messaging functions, which can be called only,
Main. xml
[Html] Android: layout_width = "fill_parent"Android: layout_height = "fill_parent">Android: id = "@ + id/textView"Android: layout_width = "wrap_content"
A variety of mobile phone assistants are included in the SMS backup this item. The main part of the text message contains four items: Content body, Event date, mode type, number address.SMS Backup ~ One. Use a stupid way to save text messages to an XML file, and save it in an external store. The following will be: SMS Backup ~ two (XML serializer),
(). toString ();
message = Edittext2.gettext (). toString ();
In Logcat You can view information about number and message log.i ("number", number);
LOG.I ("message", message); /* Get the system default information manager, it is important to note that Smsmanager is Android.telephony.SmsManager; This is related to the version we use and should be used before Android 2.0 Android.teleph
The version after Ony.gsm.S
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.