Delete SMS in Android 1.5

前端 未结 5 520
借酒劲吻你
借酒劲吻你 2020-12-02 21:27

There are many questions about it, no answers are working in my application :(

I need to remove SMS from a receiver, even if the user can see it, but it must be remo

5条回答
  •  执念已碎
    2020-12-02 22:14

    use this and be happy guys

    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    import android.telephony.SmsMessage;
    import android.widget.Toast;
    import android.net.Uri;
    
    public class SmsReceiver extends BroadcastReceiver {
    
        private Handler mHandler = new Handler();
        private SmsMessage[] msgs;
        private Context con;
    
        @Override
        public void onReceive(Context context, Intent intent) 
        {
            Bundle bundle = intent.getExtras();        
            msgs = null;
            String str = "";            
    
            if (bundle != null)
            {
                Object[] pdus = (Object[]) bundle.get("pdus");
    
                msgs = new SmsMessage[pdus.length];            
    
                for (int i=0; i

提交回复
热议问题