Von Heideck studied art in Zürich. In 1801, he entered the military academy in Munich. Since 1805 he was in the Bavarian army, he took part to the campaigns in Austria, Prussia and Tyrol, then in Spain after 1810. In 1814, with the rank of Major, he accompanied the crown prince and future Ludwig I of Bavaria to the Congress of Vienna. In 1826, he went to help the Greeks fight for their independence against the Ottoman Empire, during the Greek War of Independence. In 1827, he took part under the orders of Thomas Gordon to the attempt to help the Acropolis of Athens. In 1828, Ioannis Kapodistrias named him commander of Nafplion and a few month later military governor of Argos. In 1830, he went back then to Munich and got back his rank of colonel of the Bavarian army. He started again to paint. In 1832, when Otto the second son of Ludwig I of Bavaria was designated to become king of Greece, Heideck was nominated to the regency council. It is traced, that he lived at Kasern Straße 12  in Munich around 1850.  The Heideckstraße in the quarter Neuhausen of Munich is named in honor of him.
Question: How many years after entering the military academy did Von Heideck join the Bavarian army?
Answer: 4