Questions tagged [parcelfiledescriptor]

22 questions
6
votes
1 answer

Android VpnService.Builder.establish() sporadically null

When I try to create the tunnel interface for my VpnService, I'm getting the following error: Attempt to invoke virtual method 'java.lang.String android.os.ParcelFileDescriptor.toString()' on a null object reference The only resolve I currently…
Nathan F.
  • 3,250
  • 3
  • 35
  • 69
4
votes
1 answer

"Seekable" file descriptor to use with MediaRecorder Android 6.0 (API 23)

So I am trying to use my Android as a webcam. My code is working perfectly for API <= 22. I am using ParcelFileDescriptor's createPipe() method to create pipe for reading and writing. In short, my writing to the pipe looks like…
3
votes
0 answers

Creating Multiple ParcelFileDescriptor for a file from default file picker URI throws File Not Found Exception

I have targeted Android API level 30 and tried to create multiple file descriptors for a single file from the URI from the default file picker which looks like…
3
votes
0 answers

Closing a C++ FILE pointer which uses a file descriptor from Java

When using a file descriptor in native code, which has been obtained from a ParcelFileDescriptor, should the native side use fclose after an fdopen? The documentation states that the ParcelaleFileDescriptor instance owns the file descriptor, and it…
PerracoLabs
  • 16,449
  • 15
  • 74
  • 127
3
votes
0 answers

How to get partial write access to a file from private folder of Google Drive Android app?

I have a Google Drive Android app installed on my device with API level 21. I would like to allow for my app to read some files from Google Drive private folder on my device, make some changes and let Google Drive Android app to synchronize it.…
2
votes
0 answers

Create a FileDescriptor object on Android

I want to convert the filedescriptor (int) obtained from native to filedescriptor (Java object) //native int fd = open(......); Why doesn't example 1 work? Maybe in theory? //eg 1: FileDescriptor mFd =…
2
votes
2 answers

io.FileNotFoundException: open failed: EACCES (Permission denied)

I Was Trying to update API level 28 to 30. This is a photo editor project. the app is run successfully but when picking the photo for the crop from local storage the app not work and I saw this error. "open failed: EACCES (Permission denied)" when I…
Jebaul Nokib
  • 21
  • 1
  • 4
1
vote
0 answers

Just curious - ParcelFileDescriptor's getStatSize() returns file size in MB not MiB, why is Google making this complicated?

Phone's File manager shows the size of a randomly selected image as 7.09 MB. Android's ParcelFileDescriptor's getStatSize() method returns 7093426 bytes. This number is exactly equal to 7.09 something when you divide by 1,000,000, not…
falero80s
  • 368
  • 6
  • 12
1
vote
1 answer

Closing a ParcelFileDescriptor file descriptor after detaching

In Android I use the method detachFd from the ParceFileDescriptor to get a file descriptor that I pass to native code for usage. As the file descriptor is detached I close it in native code using fdclose. Since it is detached, should I still close…
API_1024
  • 479
  • 2
  • 13
1
vote
2 answers

How to fix wrong path for FileInputStream and FileDescriptor in kotlin

FILE is created using URI in cacheDir but when i tried to get the path, image is not found, Logged the URI before creating file and able to see proper URI for image file. Now i had created a File in app cache and tried to retrieve the path of image…
sri
  • 73
  • 1
  • 11
1
vote
2 answers

java.io.FileNotFoundException: open failed: ENOENT error in android

I am trying to get the file from picking image from photos and get intent data, save the file in internal memory and use the file to load on Image views. But I am getting the error as follows: java.io.FileNotFoundException:…
Sid
  • 2,792
  • 9
  • 55
  • 111
1
vote
0 answers

i want to open my file when download completed

I extracted some urls by jsoup. and made a download manager. and it seems parcelfiledescriptor doesn't work. i tryed regist broadcaster but did't work. I don't know where should I insert "parcelfiledescriptor" and "regist broadcaster" i have no idea…
1
vote
1 answer

Android ParcelFileDescriptor to path string

If I have a ParcelFileDescriptor that is being passed to me and I need to call an API that requires a filePathString, I don't see how to map this? Short of creating a temp file and then passing that as a path is there a cleaner way of doing this?
justdan0227
  • 1,374
  • 18
  • 48
1
vote
1 answer

Passing a read FD parcelable: when to close?

To pass large amounts of data over binder, we create a pipe, then pass the read end of the pipe over the binder as a ParcelFileDescriptor, and start a thread to write data to the write end of the pipe. It basically looks like this: public void…
Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134
1
vote
0 answers

MediaRecorder prepare fail with code -38 when using FileDescriptor from DatagramSocket

I'm trying to use the MediaRecorder to stream Video via UDP, but this code leaves me with this error: E/MediaRecorder: prepare failed: -38 I'm using RXJava2 to make sure that the DatagramSocket is created on another thread, my code is as…
1
2