The effects of the thermoelastic and piezoelectric strain exerted by an active polymer matrix on a Ni nanowire are studied at the nanoscale by measuring the inverse magnetostriction of single-contacted Ni nanowires. The reorientation of the magnetization is measured by anisotropic magnetoresitance. In the absence of strain, the Ni nanowire exhibits a typical uniform rotation of the magnetization as a function of the external field. When piezoelectric or thermoelelastic strain is present in the polymer matrix, the hysteresis loop becomes strongly modified by the inverse magnetostriction of Ni. It is shown that the ferromagnetic nanowire plays then the role of a mechanical probe that allows the effects of the mechanical strain to be characterized and described qualitatively and quantitatively. Moreover the stress exerted by the polycarbonate matrix on the nanowire is found to be isotropic while the one produced by the PVDF matrix is anisotropic.