. 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
This article is an example of how Android sends SMS. Share to everyone for your reference, specific as follows:
SMS and phone calls are the basic features of Android phones, and here are examples of how Android can deliver text messages.
The program looks like this:
I
When the device receives a new SMS message, it broadcasts an Intent containing the android. provider. Telephony. SMS_RECEIVED action.
For an application to listen to SMS Intent broadcast, you must first add the RECEIVE_SMS permission. Add a uses-permission to the application manifest, as shown in the following snippet:
AndroidManifest. xml code:
Source code o
The example of this article for everyone to share the Android mobile phone automatically get the message authentication code function for everyone to refer to, the specific content as follows
1. SMS Listening and broadcasting
2, read the message content
3, intercept the message content "can be reg interception"
4, fill out to the corresponding control
Ps:devstore test did not get the verification code
Android Phone Manager (Telephonymanger) Example:Telephonymanger is a service class that manages phone status and network information.To add a permission:
Logical function:
Package com.example.telephonystatus;
Import java.io.FileNotFoundException;
Import Java.io.OutputStream;
Import Java.io.PrintStream;
Import java.util.ArrayList;
Import Java.util.Date;
Import Java.util.HashMap;
Import java.util.List;
Import Java.util.Map;
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 is null.
Date => long type. For example, 1256539465022
Protocol => Protocol 0 sms_rpoto, 1 mms_proto
Read => whether to read 0 unread, 1 read
Statu
To use the SMS service, you must add the SMS Service permission to AndroidManifest. xml.AndroidManifest. xmlPackage com. sms;Import java. util. List;Import android. app. Activity;Import android. app. PendingIntent;Import android.
Create a new Android project.A layoutOpen the Main.xml to modify the contents as follows:Two definition stringsOpen Strings.xml Add content as follows:Three Response click eventsOpen Mainactivity.java and add the following code:Public EditText numbertext;public EditText contenttext;public void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (r.layout.main); numbertext = (EditText) This.findviewbyid (R.id.numbe
We were stitching the XML file manually in the previous section, but there was a problem with that in the previous section, such as:Insert the contents of the message sbuffer.append ("I added a So in this section we use the XML serializer to stitch up the text message content.The following code is how to stitch a file with an XML serializer:public class Mainactivity extends Activity {listAs you can see, I intentionally added a body to the content of the text message.Export to query the backup fi
Android sends text messages, calls, and emails.
SMS sending modes include:1. Use smsmanager to send text messages. The sent text messages are not stored in "information.2. Use contentresolver to send text messages, which are stored in "information. (The network transfer method is not successful in practice)3. Use intent to send text messages and call the system's "information" program.
Call modes include:1.
the phone is no problem)! Tut Good pit Daddy! What the hell is going on here? Okay, patient. I think of another onchange (Boolean selfchange, Uri Uri), this method with URI parameter is only on the higher version of the Android system, so I have to print the URI here. The results found that the print is content://sms/910, content://sms/911 and the like, there
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
the SDK What do you mean , after decompression, we open apidoc-->index.html, we can see the content of this SDK. The contents of the inside are given a clear explanation. You can also look at the Smssdk folder, which contains the SDK source code. Inside there is a smssdk_user_guide, open after you can follow the steps inside the operation. Third, the realization of SMS Verification code function1. Import the SDKIf your SDK is Smssdk 2.0.1 After t
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.