标签:int null telephony ide manage 通过 sms extends send
电话状态的监听:
/*** * 继承PhoneStateListener类,我们能够又一次其内部的各种监听方法 然后通过手机状态改变时,系统自己主动触发这些方法来实现我们想要的功能 */ class MyPhoneStateListener extends PhoneStateListener { @Override public void onCallStateChanged(int state, String incomingNumber) { switch (state) { case TelephonyManager.CALL_STATE_IDLE: Log.v(tag, "空暇状态 "); break; case TelephonyManager.CALL_STATE_RINGING: Log.v(tag, "手机铃声响了,来电号码:" + incomingNumber); break; case TelephonyManager.CALL_STATE_OFFHOOK: Log.v(tag, "通话状态 "); break; default: break; } super.onCallStateChanged(state, incomingNumber); } }
// 发送短信 smsManager = SmsManager.getDefault(); PendingIntent pIntent = PendingIntent.getBroadcast( ShopDealActivity.this, 0, new Intent(), 0); smsManager.sendTextMessage("10086", null, msg_string, pIntent, null); Toast.makeText(context, "短信已发送", Toast.LENGTH_SHORT) .show();
标签:int null telephony ide manage 通过 sms extends send
原文地址:http://www.cnblogs.com/llguanli/p/6821195.html