Lei Jun, the chairman and CEO of Xiaomi Technology and the chairman of Kingsoft Corp., seen before the 2nd plenary session of the National People's Congress on March 9 in Beijing. Etienne Oliveau/Getty Images The "Apple of China" is in serious trouble.

Sales in China of smartphones from Xiaomi, a once red-hot Chinese hardware startup touted as the country's answer to Apple, fell by a whopping 38% in the second quarter of 2016 year-on-year, according to new data from the research firm IDC.

Xiaomi did not immediately respond to a request for comment.

Xiaomi's phones are not yet available in Western markets, but the company has developed a buzzy reputation in the tech press.

The company launched in 2010, and it enjoyed meteoric growth: By the end of 2014 it was the world's most valuable technology startup, with a private valuation of more than $46 billion. (It has since been dethroned of that title by Uber.)

Specialising in cheap, high-quality smartphones, it had grown off the back of an unusually passionate fan base, which it was careful to cultivate. It liberally borrowed from Apple's playbook, including charismatic CEO keynote speeches. There is also a booming market in China for smartphones.

The company set an ambitious target for 2015: Sell 100 million smartphones. But by July, as sales began to slow, it started to become clear that it just wouldn't happen.

It ultimately sold "over 70 million," according to a company representative.

Some of Xiaomi's phones are very similar to Apple's, and Apple design guru Jony Ive has even accused the company of "theft," a charge it denies. REUTERS/Jason Lee

Earlier this year, Fortune reported that Xiaomi's revenue's barely grew in 2015. It pulled in 78 billion yuan, or $11.9 billion, for the year, up 5% on 74.3 billion yuan ($11.3 billion) in 2014 but well short of its 100-billion-yuan target for the year.

The latest figures from IDC now suggest that Xiaomi isn't just standing still: It's actually in free fall.

Xiaomi sold an estimated 10.5 million smartphones in China in the second quarter of this year, down from 17.1 million a year prior. That's a drop of 38.4%.

At the same time, its rivals Oppo and Vivo have skyrocketed, enjoying year-on-year growth rates of 124.1% and 74.7%.

(Also interesting: Apple is struggling in China as well, with shipments down 31.7% year-on-year — selling 8.6 million devices last quarter, compared to 12.6 million in Q2 of 2015.)

It’s worth noting that Xiaomi sells other products — as varied as water purifiers and hoverboards. But smartphones still make up the lion's share of the company's bottom line, with just 5% of its revenues in 2015 coming from other products, according to Fortune.

So what's behind Xiaomi's implosion? A slowing in growth, at least, was inevitable. In previous years the company was perfectly positioned to take advantage of the rapid growth in China's smartphone market. This has now dropped off, though the Chinese market is still growing, 4.6% year-on-year in Q2.

IDC points to a failure of marketing as the cause.

Xiaomi previously spent very little on marketing and was proud of it, relying on word of mouth and user hype to spread word of its products. But this tactic is no longer viable as Vivo and Oppo are spending heavily, including using "brand ambassadors" to promote their smartphones. Without any concrete ways to differentiate its products, Xiaomi has been forced to follow suit.

"In the past, Xiaomi started the trend of selling its phones online and other vendors soon followed suit and created their own online brand. After vendors witnessed OPPO's success with its R9, they also started riding on the trend of hiring celebrity endorsers to represent their brand and appeal more to the young crowd," IDC analyst Xiaohan Tay said.

"Hiring celebrity endorsers may help increase numbers in the short term, but this alone may not be sufficient to drive numbers in the long run. As there is very little differentiation across products to warrant significant brand loyalty, vendors must constantly think out of the box to get people hyped up about their products."

Xiaomi was once the head of the pack. Now it's playing catch-up — and losing.