![]() Long avaliableBlocks = path.AvailableBlocksLong ĭouble freeSpace = blockSize * avaliableBlocks įreeSpace = Math.Round(freeSpace / (1024 * 1024), 1) // Converting freespace to mb. Following is my final code for both platforms.Īndroid Code public double GetRemainingInternalMemoryStorage() So I would suggest if anyone working on functionality mention in question area try filling full your ios device and then test. How can I calculate accurate free space in iOS?Īs commented above, iOS keep some memory in cache, I filled full memory of device so that only 300 MB free space left in device. ![]() I am not sure why it is giving 2 GB less.Ībove linked android code works well. My device has total 32 GB storage memory but when I check with above code, it saw 31989469184 bytes which is near 31.98 GB (31989469184/1000/1000/1000) which looks near to correct.But similarly Device's free space is 14.2 GB and with above code it saw 12259602432 bytes which is near 12.25 GB. I am not getting accurate storage space so my functionality is not working. I am working on the functionality where I need to saw user an alert if storage space is less than a threshold value. Var freeSpace = applicationFolder.FreeSize Ĭonsole.WriteLine("totalSpace " + freeSpace) NSFileSystemAttributes applicationFolder = (Environment.GetFolderPath()) public double GetRemainingInternalMemoryStorage() I am using this link to get storage space in xamarin forms ios. ![]() I am not able to get actual free storage space from iPhone device.
0 Comments
Leave a Reply. |