观察短信在模拟器中发送应用程序

rek*_*ire 3 sms android android-emulator

有没有办法从模拟器中读取传出的短信?

在logcat中我看到这条消息:

D/SmsStorageMonitor(  738): SMS send size=0 time=1327423357467
Run Code Online (Sandbox Code Playgroud)

有没有办法获得接收器和内容?

传出的短信似乎不会保存在模拟器中.这意味着信使应用程序向我显示没有短信.

Gir*_*iya 6

是的,只需在您的应用程序中创建一个服务,并观察所有传出短信只需参考下面的代码

public class SMSObserver extends BroadcastReceiver 
{
    static final String ACTION ="android.provider.Telephony.SMS_SENT";

    @Override 
    public void onReceive(Context context, Intent intent) 
    { 
        if (intent.getAction().equals(ACTION)) 
        {
                 //your action code here
        }            
    }
Run Code Online (Sandbox Code Playgroud)