Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Broadcast Receiver for Sent SMS messages?

Tags:

I created a BroadcastReceiver and configured it with an android.provider.Telephony.SMS_RECEIVED action filter so it is called everytime the phone receives a text.

Is there some event/action or other way for my application to be notified whenever the phone sends a text (preferably independent of the application that sends it)?

So far the only option I see is to poll the content provider for content://sms/sent which doesn't even give me all sent texts because applications can choose not to put it there.

like image 977
Josef Pfleger Avatar asked Jun 13 '09 11:06

Josef Pfleger


People also ask

What device is used to receive broadcast and send some messages?

In radio communications, a radio receiver, also known as a receiver, a wireless, or simply a radio, is an electronic device that receives radio waves and converts the information carried by them to a usable form.


1 Answers

Unfortunately there is (currently) no way to implement a BroadcastReceiver because the standard sms application uses a SmsManger to send the messages but specifies concrete internal classes for the sent and delivered intents (SmsReceiver.class and MessageStatusReceiver.class respectively). Not that it is any consolation but you can find the following comment in the Sms application's source:

// TODO: Fix: It should not be necessary to // specify the class in this intent.  Doing that // unnecessarily limits customizability.

The best alternative seems to be polling content://sms/sent, potentially using a ContentObserver.

like image 58
Josef Pfleger Avatar answered Sep 18 '22 14:09

Josef Pfleger