Android打电话也是两行代码:
Intent intent = new Intent("android.intent.action.DIAL", Uri.parse("tel:10086") );
startActivity(intent);
这样便进进入呼叫界面了。

接下来我们再看一下监听电话状态的功能。

监听电话状态首先建立一个继承于PhoneStateListener电话监听类(如:TeleListener),并让TelephonyManager监听它。
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
mTelephonyMgr.listen(new TeleListener(), PhoneStateListener.LISTEN_CALL_STATE | PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTH);
TeleListener需要实现父类的几个方法,onCallStateChanged、onServiceStateChanged、onSignalStrengthChanged,根据方法名我们便可知其功能,这里就不再详述。

更多相关文章

  1. Android(安卓)去掉标题栏,状态栏,导航栏
  2. android 禁用或开启四大组件setComponentEnabledSetting
  3. Android(安卓)RIL源码分析(2)
  4. Android中判断网络连接是否可用及监控网络状态
  5. 代码实现android手机信号监听
  6. 使用saripaar对android输入控件进行快速验证
  7. android 来电自动接听和自动挂断
  8. android 来去电监听
  9. android shape 代码实现按钮背景

随机推荐

  1. 备忘
  2. android获取app的版本信息
  3. android srcollview按钮顶部停留
  4. Android练习之Linkify文字链接
  5. Android滑动解锁控件
  6. 获取amlogic源码
  7. Android中的Parcelable接口和Serializabl
  8. android 在WebView打开网页
  9. Android安卓开发 HttpURLConnection使用
  10. android获取文件大小常用类