You can set the location with the Metadata.setLocation method
   val metadata = Metadata().apply {
            location = Location() // set the location here
        }
        val contentValues = ContentValues().apply {
            put(MediaStore.MediaColumns.DISPLAY_NAME, System.currentTimeMillis())
            put(MediaStore.MediaColumns.MIME_TYPE, "image/jpeg")
            put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DCIM)
        }
        val contentUri = MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
        val outputOptions = OutputFileOptions.Builder(contentResolver, contentUri, contentValues)
            .setMetadata(metadata)
            .build()
        imageCapture.takePicture(outputOptions, mainExecutor, object : OnImageSavedCallback {
            override fun onImageSaved(outputFileResults: OutputFileResults) {
              Log.d(TAG, "Photo URI ${outputFileResults.savedUri}")
 
            }
            override fun onError(exception: ImageCaptureException) {
                Log.e(TAG, "Error", exception)
            }
        })