Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all
The Xamarin app runs smoothly on Android 10. When transferred to Android 11 and Lenovo Tablet, on talking photos gives error

phone available memory is not enough.Temporarily cannot take pictures

But it has 128 GB free .Restart is the only solution.

I use this folder as the store folder. Do i have to change it ?
string folder = Path.Combine("/storage/emulated/0/Android/data", packageName, "files/Pictures/");

Any suitable folder samples?

Any help would be appreciated.

Happy new year to all.

What I have tried:

I deleted all the app files. Same problem
Posted
Updated 14-Feb-23 4:54am
v2
Comments
Dave Kreskowiak 30-Dec-22 15:06pm    
The phone does NOT have 128GB of RAM. It has 128GB of STORAGE, which is not the same thing.

You need to figure out why you're running the phone out of RAM. If you're taking video or a lot of pictures, you're probably not freeing resources and just trying to hold onto more and more data.

Without any code to look at and a much better description of what your app is doing, you're not going to get an answer to this question.
Ins App 31-Dec-22 2:37am    
Thanks for the assist
I use this as a folder to store camera data. I use Xam.Plugin.Media for photos.

string folder = Path.Combine("/storage/emulated/0/Android/data", packageName, "files/Pictures/");

It was working on Android 10. Stopped on 11.

Thanks again

I recall my colleague facing a similar problem. It was related to general usage of the image for display. She then used a third party opensource to display the image that optimized it.

Believe it was FFImageLoading - GitHub - luberda-molinet/FFImageLoading: Image loading, caching & transforming library for Xamarin and Windows[^]

You would need to scale down your image. Something like:
From:
HTML
<Image Source="mypic.png" />
To:
HTML
<ffimageloading:CachedImage Source="mypic.png" BitmapOptimizations = true, DownsampleToViewSize = true/>

Believe there would be difference in how Android10 & Android11 is working behind the scenes for this rendering leading to issue in one only.

PS:
1. As Dave suggested, also check for any memory leaks or holding on to not needed resources that could be leading to issue.
2. Make sure you have all the components latest & compatible that are part of your project
 
Share this answer
 
Comments
Ins App 31-Dec-22 2:40am    
okbut memory is empty and it takes 5 pictures and crashes with memory error. It doesn't look like picture size problem.
And it was working on android 10. On 11 started crashing
And i have tested the default camera alone. It produces the above memory problem.
It looks like a bug at camera android 12
 
Share this answer
 
Well
I used another Tablet with android 12 and it works ok. So it seems that it was a tablet (Lenovo) specific problem
 
Share this answer
 
Comments
CHill60 14-Feb-23 12:20pm    
Rather than posting multiple solutions to the same question, please note the "Improve solution" link next to your original solution. That is the best way to update the thread

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900