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