I found the answer using android - save image into gallery.
The method suggested in the answer worked perfectly, but you have to make sure it's not returning null. It was doing that for me because I had no existing photo directories on the emulator I'm using. Taking a photo on the emulator solved it for me.