posts - 71,  comments - 203,  trackbacks - 0
* Registers a listener object to receive notification of changes
* in specified telephony states.
* To register a listener, pass a {@link PhoneStateListener}
* and specify at least one telephony state of interest in
* the events argument.
* At registration, and when a specified telephony state
* changes, the telephony manager invokes the appropriate
* callback method on the listener object and passes the
* current (udpated) values.
* To unregister a listener, pass the listener object and set the
* events argument to {@link PhoneStateListener#LISTEN_NONE LISTEN_NONE} (0)

telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
				psListener = new PhoneStatusListener();
				telManager.listen(psListener, PhoneStateListener.LISTEN_CALL_STATE);  //监听
telManager.listen(psListener, PhoneStateListener.LISTEN_NONE);  //取消监听

posted on 2010-12-07 12:35  stay  阅读(816)  评论(0编辑  收藏