我创建了一个的BroadcastReceiver
并用 android.provider.Telephony.SMS_RECEIVED
动作过滤器配置它,所以它是所谓的每次电话的接收的文本。
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.
有没有一些事件/操作或其它方式为我的应用程序能够获知每当电话的发送的文本(pferably独立发送它的应用程序$ P $)?
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.
推荐答案
不幸的是,(目前)没有办法实施BroadcastReceiver因为标准短信应用程序使用SmsManger发送邮件,但指定了具体的内部类的发送和传递意图( SmsReceiver.class和
)。不,这是任何安慰,但你可以找到在SMS应用程序下面的注释source: MessageStatusReceiver.class
分别为
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.
最好的选择似乎是轮询内容://短信/发送
,可能使用ContentObserver.
The best alternative seems to be polling content://sms/sent
, potentially using a ContentObserver
.
相关推荐
最新文章