BEIJING — The editorial was scathing.
People’s Daily, the flagship newspaper of the Chinese Communist Party, was taking aim at Apple, accusing it of serving as an “escort” for “rioters” in Hong Kong by providing an app that allows protesters to track police movements.
“Letting poisonous software have its way is a betrayal of the Chinese people’s feelings,” warned the article, which appeared this week and was written under a pseudonym, “Calming the Waves.”
As China seeks to contain pro-democracy demonstrations in Hong Kong, state-run news outlets are increasingly lashing out at foreign companies, accusing them of enabling the protest movement.
The National Basketball Association faced the wrath of the Chinese public this week after the general manager of the Houston Rockets briefly shared an image on Twitter that said, “Fight for freedom, stand with Hong Kong.”
Apple also faced a backlash in China, a vital market, with some internet users demanding a boycott of iPhones because of the Hong Kong app.
Analysts say the increasingly tough tone of the Chinese media is part of Beijing’s efforts to inflame nationalism at home and intimidate multinational companies into toeing the party line.
As China and the United States struggle to reach a trade deal, the war of words also reflects a broader geopolitical struggle.
“The psychological cold war has really begun,” said Yik Chan Chin, a lecturer in media and communication studies at the Xi’an Jiaotong-Liverpool University in Suzhou, China.
Ms. Chin said the crisis in Hong Kong, where demonstrations have continued for four months, had energized the state-run media because many mainland Chinese believe the protesters are seeking independence from Beijing.
“The whole discourse now is shaped toward supporting China’s position,” she said.
On Wednesday, the N.B.A. continued to face criticism for the post on Hong Kong. The Shanghai Sports Federation announced that an N.B.A. fan event scheduled for Wednesday evening had been canceled. The league apologized to Chinese fans, but its leaders have also spoken about the importance of free speech and pursuing principles over profit, drawing a further backlash in China.
The scrutiny of Apple began over the weekend, after Chinese news outlets picked up on a Bloomberg report that Apple was allowing the app, HKmap.live, to be downloaded through its App Store. Tens of thousands of internet users took to Weibo, a microblogging site, to express outrage.
Apple had previously rejected HKmap.live from the App Store, saying it allowed people to evade law enforcement, the app’s developer said in a Twitter message, but the company changed course last week.
Apple has previously shown a willingness to block apps in China at the government’s request. The company did not respond to a request for comment.
The app is popular among protesters, who use it to avoid the police and tear gas during tense standoffs that have raged across the city. It is currently the most downloaded travel app in Hong Kong.
Furor over the app intensified late Tuesday, after People’s Daily published the editorial, which warned of unspecified consequences for Apple.
Chinese commentators often use pseudonyms, and “Calming the Waves” specializes in articles about the Hong Kong crisis with headlines like “Ban masks, sterilize and disinfect Hong Kong.” The author, who began publishing about the demonstrations this month, has said that the protesters are “utterly evil” and that Beijing will not compromise with them.
On Wednesday, the Chinese Ministry of Foreign Affairs weighed in on Apple’s decision to make the app available.
“Anyone with a conscience and sense of justice should boycott and object to this instead of supporting and indulging it,” Geng Shuang, a ministry spokesman, said, according to Chinese news reports.
Despite the caustic tone in the news media, some worry that nationalism could get out of hand and hurt China’s global image.
Hu Xijin, editor in chief of Global Times, a state-run tabloid that is one of the Communist Party’s most vocal cheerleaders, said the media would not go too far in criticizing Western companies. In a message sent by Twitter, he vowed not to “negate a certain American company overall because of one specific incident.”
“There are some more radical voices on Chinese internet,” Mr. Hu said, “but the formal media will keep a distance from those voices and be more objective and rational.”
Some free speech advocates expressed concern about the increasingly aggressive tone in the Chinese news media, saying it showed the government’s eagerness to punish foreign companies until they embraced the party’s point of view wholeheartedly.
“If you show your willingness to back down and kowtow to the party, the party considers you a pushover,” said Maya Wang, a senior China researcher at Human Rights Watch in Hong Kong. “They will increasingly encroach on your bottom line.”
Albee Zhang contributed research.