I came across a very interesting problem, the screen of my old Android phone got damaged and I badly wanted to read SMS on my phone. That had an old SIM card with the bigger size 🙁 So what to do?
As is clear from the title that the solution is for developers, what I did was I used Android Android development skills and using that I logged all SMS from the device on to the screen of my laptop and how did I do that?
I did that using Android Studio and
Android Debugger Bridge (ADB). So basically the solution is only for the developers the common man cannot do it if you really want to do it, then go and hire an Android developer and he or she can do it for you probably.
So coming to the solution, what I did was it created an Android app in using Android studio and I created an
Activity and inside that
Activity, I called a method would read all the SMS of that phone.
Before jumping deep into the solution you need to consider:
- You need to have USB Debugging and Developer options turned on the phone.
- And because I was programming using that phone even before the screen got damaged, so I got lucky that I already had turned on USB Debugging on that phone.
- If you are not a developer then it might be a problem for you. Go ahead and hire an Andriod developer. Game Over!!
- What is the Android version of the phone? You need to accommodate that in the
build.gradlefile. Suppose your Android API Level is 8, then
minSdkVersionin your build.gradle should be less than or equal to this number.
- If your phone is old, then for dependencies, you need to make sure that there is no reference to latest libraries like Android.
Create a New Android App using Android Studio.
minSdkVersion less than or equal corresponding SDK version of your phone. Remove all dependencies, especially the new ones like
androidx which are not compatible with old
Notice the dependencies section.
Add the permission to read SMS in
AndroidManifest.xml. Notice the
uses-permission tag. Check my full file.
Modify the default MainActivity. First, we need to update the XML layout file, so as to make sure it is not using any advance Views or ViewGroups which are not part of older Android SDK versions (e.g. ConstraintLayout, etc).
Contents don’t matter but you just need to make it compatible with the SDK version of your phone. I hope you get the point.
Add the function to read SMS in your
MainActivity.java and call that method in
It simply reads the SMS Inbox Content Resolver with URI
content://sms/inbox and logs the desired entries to
Here is my full MainActivity.java
Connect your phone to your system using USB Debugging and run the App.
Here is the result.
That’s it. I hope you find this solution helpful. Write your doubts or questions in the comments section.