Android system SMS source code dependent library, the source code can be run

Source: Internet
Author: User

Android System SMS Source Library Click to open the link

Android System SMS Source Click to open the link


The new project needs to do the SMS module function, this SMS module non-android system SMS module, is the use of 360 Zhang Yong-led open-source framework for URL interception, stripped out of the SMS module

The first step:

To download the Android system source code, by comparing 4.4 and 4.4+ version of the source code, decisive use of 4.4 of the source, why? Because 4.4 Short message source class less, future bug less, SMS module code is as follows


Step Two:

I took as for the (I initially was debugging on Eclipse, then moved to as), the above several classes imported into, it must be a lot of bugs, and later found in the source of related classes, I first put out the last class


Let me just say a few bug points:

1, first, the code of this SMS module is a dependent library exists (later may be moved to the project), so that in the main project configuration file needs to fill in the following

Xmlns:tools= "Http://schemas.android.com/tools"
<USES-SDK tools:overridelibrary= "Com.android.providers.telephony"/>
2, because the 360 security module is dependent on the 23 API, at first afraid of relying on error, I rely on 22 of the API, to avoid the conflict does not know

Compilesdkversion    buildtoolsversion "23.0.2"    defaultconfig {        minsdkversion]        targetsdkversion        Versioncode 1        versionname "1.0"    }

3, because there are many errors in the code, take a mistake, Setappops (appopsmanager.op_read_sms, appopsmanager.op_write_sms); This is an error, the workaround is as follows

Because my code is excerpt of 4.4 of the system text source, so I downloaded from the Internet 4.4 Source compiled class file, here first these class files


4. After the class file has been downloaded, go to the following directory, the blue box is the modified Android.jar red box is self-brought, we need to change the blue box jar package, because this jar can solve such methods as Setappops, is to use the compiled. class file with the SDK's own Android for comparison and modification



5, then look at the configuration file of the CP, here say 2 o ' ha, change to True, and then customize the SMS URL


  <provider android:name= "Com.android.providers.telephony.TelephonyProvider" android:authorities=            "Telephony_launcher" android:exported= "true" android:multiprocess= "true"/> <provider            Android:name= "Com.android.providers.telephony.MmsProvider" android:authorities= "Mms_launcher" Android:exported= "true" android:multiprocess= "true" android:readpermission= "ANDROID.PERMISSION.R Ead_sms "android:writepermission=" Android.permission.WRITE_SMS "> <grant-uri-permission androi        d:pathprefix= "/part/"/> <grant-uri-permission android:pathprefix= "/drm/"/> </provider> <provider android:name= "Com.android.providers.telephony.MmsSmsProvider" Android:authoritie s= "Mms-sms_launcher" android:exported= "true" android:multiprocess= "true" android:readperm Ission= "Android.permissiOn. Read_sms "android:writepermission=" Android.permission.WRITE_SMS "/> <provider android:n Ame= "Com.android.providers.telephony.SmsProvider" android:authorities= "Sms_launcher" Android:exporte            D= "true" android:multiprocess= "true" android:readpermission= "Android.permission.READ_SMS" android:writepermission= "Android.permission.WRITE_SMS"/>



6, then take the SMS to explain the

Setappopps just started in order to solve this method, modified Android.jar because it is the system comes with, just start also did not go to comment Ah, remove code of, is afraid to change more late bug, Setappopps method need to remove, Otherwise it could not be created, I will solve this bug by log.

android4.4 The default SMS mechanism is to not let the background silently send text messages, but unfortunately, the original does not prohibit the non-default text message texting

And I write this blog, this is just the first step to insert can, seemingly delete the changes I have not tested, I have written before demo,4.4 the default system text message is not directly deleted, modified, you need to reflect the method before you can operate


@Overridepublic Boolean onCreate () {//setappops (appopsmanager.op_read_sms, appopsmanager.op_write_sms); mopenhelper = Mmssmsdatabasehelper.getinstance (GetContext ()); return true;}

7, then is to modify the existence of some bug reflection method

8, then is to delete the red, and kill style file


So far, basically bugs are almost there.


Here is the eclipse on the bug will be less, you can refer to the Lib way convenient, there are the as inside those redundant style ah Themebug

I also began to use as in the early April, as the pain of the ruthless, but as there is a place better than eclipse, Eclipse compile sometimes compile library does not pass, always card, as compiled quickly





Android system SMS source code dependent library, the source code can be run

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.