Nexus 4 mic not working (Solved)

Hey people of GooglePlex. So my Nexus 4's mic stopped working out of nowhere. I've also tried the safe mode but to no success. The only solution I've manage to find is that I have to turn the speaker on for the mic to work. Has anyone encountered this issue? Any advice would be great. Thanks

Edit: Working

I downloaded an app called soundabout and restarted my device. Turned the phone output to earpiece and then back to default. I think it was detecting my earphones for some reason.