Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Android 中,我目前使用 onCallStateChanged 来检测手机状态的任何变化。但是,我想知道手机的状态是什么,而不必等待状态的变化。例如,我希望应用程序自动拨打一个号码,但需要知道电话是否已在使用中(挂机)。
使用TelephonyManager。只要您声明了权限,您就可以随时查询它。