Android (Java) Learning note 248:contentprovider use of virtual SMS

Source: Internet
Author: User

1. Virtual SMS Application Scenario :

Rush to get away? Coping with wife (husband, boyfriend and girlfriend Zhagang)?

Use a virtual call to SMS. Simply set up, the software will simulate a "real" call or text message at the specified time to confuse the other person, through the "real" evidence to let the other side believe you, take this to get away! is also to deal with the check, friends between the funny weapon, lock screen state can also be virtual to point oh.

2. The following example demonstrates the logical principle of the case, as follows:

(1) Create a new Android project, named " Virtual SMS ", as follows:

(2) UI is not edited, the main design mainactivity, as follows:

1  Packagecom.himi.virtualsms;2 3 Importandroid.app.Activity;4 ImportAndroid.content.ContentResolver;5 Importandroid.content.ContentValues;6 ImportAndroid.net.Uri;7 ImportAndroid.os.Bundle;8 ImportAndroid.view.Menu;9 ImportAndroid.view.MenuItem;Ten ImportAndroid.widget.TimePicker; One  A  Public classMainactivityextendsActivity { -  - @Override the     protected voidonCreate (Bundle savedinstancestate) { -         Super. OnCreate (savedinstancestate); - Setcontentview (r.layout.activity_main); -          +          -         NewThread () { +              Public voidrun () { A                 Try { atThread.Sleep (10000); -                      -}Catch(interruptedexception e) { -                     //TODO Auto-generated catch block - e.printstacktrace (); -                 } inContentresolver resolver =getcontentresolver (); -Uri uri = uri.parse ("content://sms/"); toContentvalues values =Newcontentvalues (); +Values.put ("Address", "95533" ); -Values.put ("Date", System.currenttimemillis ()); theValues.put ("type", 1); *Values.put ("Body", "Your account balance is ¥ 100,000,000,000 yuan"); $Resolver.insert (Uri.parse ("content://sms/"), values);Panax Notoginseng             }; - }.start (); the          +          A     } the  +}

In fact, the logical implementation is very simple.

Android (Java) Learning note 248:contentprovider use of virtual SMS

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.