Code example for TelephonyManager

Methods: getCallState

0
	 */ 
	private static boolean isInCall(Context context)
	{ 
		if (sInCall == -1) {
			TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
			sInCall = (byte)(manager.getCallState() == TelephonyManager.CALL_STATE_IDLE ? 0 : 1);
		} 
		return sInCall == 1;
	} 
 
	/** 
	 * Set the cached value for whether the phone is in a call. 
	 * 
	 * @param value True if in a call, false otherwise. 
	 */ 
	public static void setInCall(boolean value)
	{ 
		sInCall = value ? 1 : 0;
	}