我需要监听所有传入和传出的短信并将其存储在文本文件中.为此,我使用广播监听器来监听所有传入的消息.这很好用.但对于传出的短信,如何在没有活动的情况下注册内容观察者?我不希望我的申请中有任何活动.现在广播接收器甚至在重新启动后监听,即使重启后内容观察者也会听?如何合并这两个功能?
这是我的manifest.xml的一部分
这里,扩展广播接收器的类
public class map extends BroadcastReceiver {
/** Called when the activity is first created. */
private static final String ACTION = "android.provider.Telephony.SMS_RECEIVED";
public void onReceive(Context context, Intent intent)
{
// Here I store the sms in text file
}
任何帮助表示赞赏.谢谢.