Spanish colonies in the Californias, created in part to forestall Russian expansion, were militarily weak. The military had only a few hundred men in the whole territory, and no ships at all. It was easily outgunned by the two insurgent ships that sacked and burned the capital, Monterey, in 1818. Spain had always had too much going on to invest in developing California.
Enter Russia. It had been expanding eastwards by conquering local societies as it went. Once the empire reached the Pacific Ocean, the Russian-American Company was formally permitted to settle Alaska. It established colonies there, which were perennially short of food, contributing to their eventual sale to the United States. Spanish officials took fright and monitored Russian encroachment, but were unable or unwilling to oppose the installation of Russia's outpost Fort Ross.
After the Napoleonic Wars ended, Russia sponsored several dozen long-range voyages. Officials of the Imperial Navy on round-the-world trips and Russian-American Company ships from Sitka both made contacts throughout California. Several of the Russian visitors who wrote up their experiences noticed the province's inadequate defenses; some, especially Dmitry Zavalishin, suggested that Russia should acquire California.
The Russian-American Company could not have sponsored an invasion nor a settlement of California, but the Imperial Russian Navy could have. This acquisition could have solved the problem of provisionment to the Russian Pacific rim and dramatically expanded Russia's sphere of influence. Spain would not have found out for many months, and would have had trouble retaliating since three viceroyalties were in revolution at once, including the one from which any reinforcements for California would have to be sent. For all its vaunted navy could do, Spain was about to lose nearly all its colonies; Russia was not. Independent Mexico wasn't about to be able to defend California either; there wasn't much of a fight when the United States sent a few ships to take over.
Aware of Zavalishin's advocacy, and already possessing one outpost in the area, Tsars Alexander I and Nicholas I could have taken California for Russia between approximately 1815-1845. Why didn't they?