I am unable to save a pdf generated and saved locally in my firebase

In my Manifest.xml the provider looks like this:

<provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>

My provider_paths looks like this:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path
        name="external_files"
        path="." />
    <cache-path name="cache" path="/" />
</paths>

My pdfGenerator code:

PdfGenerator.getBuilder()
                        .setContext(this)
                        .fromViewSource()
                        .fromView(binding.root)
                        .setFileName(patId)
                        .setFolderNameOrPath(getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)?.absolutePath)
                        .actionAfterPDFGeneration(PdfGenerator.ActionAfterPDFGeneration.NONE)
                        .savePDFSharedStorage(xmlToPDFLifecycleObserver)
                        .build(object : PdfGeneratorListener() {
                            override fun onFailure(failureResponse: FailureResponse) {
                                super.onFailure(failureResponse)
                                Log.d("termsResp", failureResponse.errorMessage)
                            }

                            override fun onStartPDFGeneration() {
                            }

                            override fun onFinishPDFGeneration() {
                                binding.btnUpdateSignature.visibility = View.VISIBLE
                                binding.btnGeneratePdf.visibility = View.VISIBLE
                            }

                            override fun showLog(log: String) {
                                super.showLog(log)
                                Log.d("termsResp", log)
                            }

                            override fun onSuccess(response: SuccessResponse) {
                                super.onSuccess(response)

                                val pdfFile = response.file
                                val pdfUri = FileProvider.getUriForFile(
                                    this@TermsOfRespActivity,
                                    "${binding.root.context.packageName}.provider",
                                    pdfFile
                                )

                                Log.d("termsResp", "$response -- $pdfFile -- $pdfUri -- ${response.pdfDocument}")

                                uploadTerms(pdfUri)
                            }
                        })

My uploadTerms code:

private fun uploadTerms(termsPdf: Uri) {
        try {
            val userId = mAuth.currentUser!!.uid

            val imagesRef = storage.reference
                .child("users")
                .child(userId)
                .child("patients")
                .child(patId)
                .child("terms")

            val dbRef = db
                .collection("users")
                .document(userId)
                .collection("patients")
                .document(patId)

            val fileName = "terms-$patId.pdf"
            val imageRef = imagesRef.child(fileName)

            val inputStream = contentResolver.openInputStream(termsPdf)
            if (inputStream != null) {
                imageRef.putStream(inputStream)
                    .addOnFailureListener { error ->
                        Log.d("termsResp", "Erro ao fazer o upload: ${error.message} -- ${error.stackTrace}")
                    }
                    .addOnCompleteListener {
                        imageRef.downloadUrl.addOnSuccessListener { url ->
                            dbRef
                                .update("terms", url.toString())
                                .addOnSuccessListener {
                                    Utils.sendSnackBar(
                                        binding.root,
                                        getString(R.string.updated_successfully)
                                    )
                                    dialog(
                                        getString(R.string.menu_account),
                                        getString(R.string.updated_successfully)
                                    )
                                    finish()
                                }
                                .addOnFailureListener { exception ->
                                    dialog(
                                        getString(R.string.error),
                                        exception.message.toString()
                                    )
                                }
                        }
                    }
                inputStream.close()
            } else {
                Log.d("termsResp", "InputStream is null")
            }
        } catch (exception: Exception) {
            Log.d("termsResp", exception.message.toString())
        }
    }

I am using the Android-XML-to-PDF-Generator to generate pdf files of an entire view in my kotlin app and then I want to save it in my firebase storage, the pdf is generated and saved in firebase correctly only up to api 32, from api 33 onwards pdf is generated but the app is unable to save the file in firebase, the following error appears: open failed: EACCES (Permission denied)

I tried using android:requestLegacyExternalStorage=”true” in Manifest.xml but found that it only works up to Android 10

I tried the MANAGE_EXTERNAL_STORAGE permission, but the app was not accepted

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật