[library] Fix saving files when on a device without external storage.

The reason was that createTempFile defaults to the
 external storage. I've now added a new Builder constructor
 which takes a Context. We now use getCacheDir as the
 dir for temp files.