4.4原生应用获取通话状态
import com.android.internal.telephony.ITelephony;
import android.os.ServiceManager;
private boolean phoneIsInUse() {
boolean phoneInUse = false;
try {
ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
if (phone != null) phoneInUse = !phone.isIdle();
} catch (RemoteException e) {
Log.w(TAG, "phone.isIdle() failed", e);
}
return phoneInUse;
}
参照:http://www.myexception.cn/android/922374.html