good morning thanks, I am new to Kotlin, I need to upload PDF to Android, I use the developer.android.com documentation.
-We have an Api, which receives the file in Base64.LO QUE FUNCIONA
-With gallery images and taking photos it works,
This is the image code.
val iGaleria = Intent(Intent. ACTION_PICK , MediaStore.Images.Media. EXTERNAL_CONTENT_URI )
iGaleria. type = “image/*”
startActivityForResult(iGaleria, FOTO_GALERIA )
After selecting or taking the photo, the onActivityResult method I get the uri data? .Data
I convert it to base64 and send.
I try to do the same for PDF files but it doesn’t work for me. (I can view the PDF, delete or delete the PDF from the device)
This is the intent for the PDF
val intent = Intent(Intent. ACTION_GET_CONTENT )
intent. type = “application/pdf”
intent.addCategory(Intent. CATEGORY_OPENABLE )
startActivityForResult(intent, DOCUMENTO )
I have validated this documentation.