短息工具类SMSUtils
package com.pzq.test.zhuanpan4; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Handler; import android.telephony.SmsMessage; import android.text.TextUtils; import android.util.Log; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by asus on 2016/6/26. */ public class SMSUtils { private BroadcastReceiver smsReceiver, codeReceiver; private IntentFilter filter, mIntentFilter; private Handler handler; private String strContent; private String patternCoder = "(? * * registerReceiver(); u = new SMSUtils(MainActivity.this); * private void registerReceiver() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(SMSUtils.MSMCode_CHANGE_BROADCAST); registerReceiver(new SMSBroadcastReceiver(), intentFilter); } class SMSBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction() == SMSUtils.MSMCode_CHANGE_BROADCAST) { Bundle bundle = intent.getExtras(); smScode = bundle.getString("code"); Log.d("mainpzqtest....", "mBroadcastReceiver...." + smScode); et.setText(smScode); } } }; * * */ }
当前名称:短息工具类SMSUtils
网站URL:http://scjbc.cn/article/ihjgjj.html