When the application to the court is made without notice to the adverse party, and the writ is allowed, the alternative must be first issued; but if the application is upon due notice and the writ is allowed, the peremptory may be issued in the first instance. With the alternative writ and also with any notice of an intention to apply for the writ, there must be served on each person against whom the writ is sought a copy of the petition. The notice of the application, when given, must be at least ten days. The writ cannot be granted by default. The case must be heard by the court, whether the adverse party appears or not.
Ca. Civ. Proc. Code § 1088