0

是否可以将短信发送到设备或安卓手机,以便短信在指定时间(比如 30 分钟)后自行删除?我用来发送短信的代码是:`

      public class SMSTestActivity extends Activity {
/** Called when the activity is first created. */
String str, str1;   
@Override
public void onCreate(Bundle savedInstanceState) {
    final Button btn;
    final EditText etb, etb1;
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    btn=(Button) findViewById(R.id.btn);
    etb=(EditText) findViewById(R.id.txtMsg);
    etb1=(EditText)findViewById( R.id.phNum);

    btn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v)
        {
            str=etb.getText().toString();
            str1=etb1.getText().toString();

            sendSms( str1, str);    

        }
    });
}

private void sendSms(String phonenumber, String message)
{
        SmsManager x=SmsManager.getDefault();
        x.sendTextMessage(phonenumber,  null, message, null, null);
}

public void display(View v)
{
      final Button bt;
      bt=(Button) v;
      bt.setText("Hello");

}

}

4

1 回答 1

0

Class 0 SMS 将显示在屏幕上,除非用户选择保存它,否则将被删除,如果您可以设法绕过 Android 试图阻止您发送 Class 0 SMSes。更多信息请参阅Android 上的 Class 0 SMS(flash SMS)

于 2012-12-28T07:14:17.607 回答