A member of the military junta that China backed for decades, Mr. Thein Sein met President Obama in November during what was the first visit by a sitting American president to Myanmar. Mr. Thein Sein has visited China twice in the past six months. The leader of the opposition, Daw Aung San Suu Kyi, was at the White House earlier this year and is expected in Beijing soon.

“It is in China’s self interest to think about the impact of their investments,” said Thant Myint-U, a Myanmar historian and author of “Where China Meets India: Burma and the New Crossroads of Asia.” “In the long term, it is difficult to see a Myanmar where China is not important. But there is a chance that China will no longer be the dominant actor in Myanmar, and that is worrying for some people in China.”

That concern has prompted Chinese officials, worried about losing Myanmar to the Americans, to push back. When a veteran Chinese diplomat, Wang Yingfan, was appointed several months ago as special envoy to Myanmar, he immediately flew there and spoke about the social obligations of Chinese state-run corporations.

And Gao Mingbo, the head of the political section at the Chinese Embassy in Yangon, said: “The companies must retain the support of the local communities. That has been the consistent message of the embassy: to be open, to be engaged.”

He created the embassy’s Facebook page; although Facebook is blocked in China, it is a tool that Chinese officials in Yangon, Myanmar’s commercial capital and main city, are using to reach citizens.

“If you don’t walk the walk and just talk the talk, you won’t win the hearts and minds of the local people,” Mr. Gao said.