Creating fake SMS with Android
How to crate fake sent and received SMS
Android fake SMSI was curious about how hard it can be to create fake SMS. So I decided to do a small research. I found a simple app that allows you to create a fake SMS. The interface is very straightforward. User can set a type of message,date and time. The only thing you have to agree with, is to set this app as a default message application. At this point, I was sure it is possible to do this without root permissions.
My first idea was to send some fake intent to pretend the system received a new SMS. I did some searching but any of it works. Lots of answers were pointing to "android.provider.Telephony.SMS_DELIVER" which is the system intent action for broadcasting. But since android 4.4 (KitKat) there is only one app, that is selected as default messaging app and can receive this intent. Broadcasting of this intent is allowed only for system applications. The permission for reading/writing SMS is also allowed only for default messaging app. There is a blog post that describes all these changes from Android 4.4.
After reading above mentioned blog post I updated my application so it can be used as default message app (I've just updated the manifest and created all necessary receivers with empty body). Then I realized, I don't need to send and broadcast, I can simply write a SMS through content provider URI. Following these steps allows you to create fake SMS.
- to make an application as a message application, you need to create receivers and service
- add permissions to manifest: WRITE_SMS, READ_SMS, RECEIVE_SMS
- at the start of an activity (or writing new SMS), you have to request a user to set this application as default application
- don't forget to check out if user has a right to use permissions to read/write SMS (request user for required permission)
- just write a new message getContentResolver().insert( Uri.parse("content://sms/inbox"), values);
Now you can create a fake SMS generator for your friends, family or even favourite transport service :) .
download source code here