Only in limited cases. In Shanghai, unemployment insurance is available to foreigners who hold a Chinese permanent-residence ID (and to HK/MO/TW residents), not to ordinary work-permit holders. The three conditions are: at least one year of contributions, unemployment not caused by your own fault, and registration as unemployed with a job-search requirement.
Nationwide (all cities)
The three conditions
The three conditions. To receive unemployment benefits you must satisfy all three, which are set nationally: (1) the employer and you have contributed to unemployment insurance for at least one full year before the unemployment; (2) the unemployment was not caused by your own intentional act (you were not fired for cause, and did not resign voluntarily); (3) you have registered as unemployed and are actively seeking work.
Local variations
Who can claim it in Shanghai
Who can claim it in Shanghai. Under the Social Insurance Law and the Interim Measures for Foreigners' Social Insurance Coverage, foreigners employed in China can join unemployment insurance. But Shanghai's eligibility list is specific: it covers those whose last social-insurance registration was in Shanghai, including HK/MO/TW residents and foreigners with a permanent-residence ID. Ordinary work-permit holders are not on the Shanghai list.
How and how much in Shanghai
How and how much in Shanghai. Apply online (the 'Suishenban' app or its WeChat/Alipay mini-programs) or at a community service center. In Shanghai the benefit is 2,305 yuan/month for months 1–12 and 1,844 yuan/month for months 13–24; one year of contributions yields 2 months, each additional year adds 2 months, capped at 24 months.