Conductive hydrogels possess excellent flexibility, conductivity, and sensing properties, making them important carrier materials for flexible strain sensors. They show promising application prospects in fields such as human motion detection and artificial intelligence. This paper introduces polyaniline (PANI) and glycerol (GL) into the magnesium acrylate (AMgA) monomer and prepares the polymagnesium acrylate/glycerol/polyaniline (PAMgA/GL/PANI) hydrogel by free radical polymerization method. When the addition of PANI is 9 wt.%, the PAMgA/GL/PANI hydrogel exhibits good mechanical properties, with a tensile strength of 0.385 MPa, an elongation at break of up to 505%, a compressive strength of 1.04 MPa, and its room temperature conductivity is 1.437 S m−1. Even after freezing at −20 °C, its conductivity can still reach 1.254 S m−1. When the tensile deformation of this conductive hydrogel reaches 500%, the gauge factor (GF) reaches 10.33. In addition, the PAMgA/GL/PANI hydrogel also has good self‐healing, adhesion, and moisture retention. These excellent characteristics make it suitable as a flexible strain sensor that can not only accurately monitor human joint movements and subtle physiological signals but also serve as an encrypted information transmission medium.