Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing text of Android sms

Tags:

android

sms

I want to create a censorship app for Android. Idea is that service would "listen" for "SMS_RECIVED" broadcast, and when new sms arrives, it would change some parts of it before system sms app receive it. How can i change text of incoming sms message? Is there any example?

EDIT: What do you think about this: After receiving sms broadcast, my app would search SMS INBOX database for unread messages and then change sms text directly in database. Does it sound better?

like image 226
guest86 Avatar asked May 26 '11 15:05

guest86


1 Answers

You can intercept the message and cancel it based on a particular filter, but you won't be able to change the text body.

The text body is stored in the class com.android.internal.telephony.SmsMessageBase, so you do not have direct access to it through the public API. You might get access to it through reflection.

like image 188
Aleadam Avatar answered Sep 26 '22 03:09

Aleadam