code: private static Uri createAccessibleTempFile(Context ctx, String authority) throws IOException {
          File dir = new File(ctx.getCacheDir(), "camera");
          File tmp = createTempFile(dir);
  
          // Give permissions
          return FileProvider.getUriForFile(ctx, authority, tmp);
      }
docs: Generate an accessible temporary file URI to be used for camera captures
  @param ctx
  @return
  @throws IOException