Police received reports of a man firing a gun near Riverside Elementary School in the 5400 block of Glenn Avenue at around 2:30 p.m.
Officers responded and placed the school on lockdown.
They located the suspect, who had been firing shots in the air and attempting to shoot at passersby. Nobody was hit by gunfire.
One officer fired a Taser to subdue the man, but he was wearing ballistic body armor, and the Taser had no effect. The suspect then charged the officer, police said.
After a brief struggle, police took the man into custody. One officer suffered minor injuries during the scuffle, police said.
Police identified the man as 31-year-old Christopher Trinh. Police said they found the gun Trinh was allegedly firing, and spoke to three witnesses who said Trinh had tried to shoot at them.
A search of Trinh's apartment turned up more guns and ammunition.
Trinh was booked into the Martinez Detention Facility, police said.