jamesmontemagno / Xamarin.Plugins

Cross-platform Native API Access from Shared Code!
MIT License
1.3k stars 380 forks source link

Taking picture not working on Android 5.1.1 #293

Closed schiari closed 8 years ago

schiari commented 8 years ago

I'm using the Plugin.Media version 2.4.0-beta (which fixes picture orientation), it's working on Adroind 4.1.2 (Jelly Bean) and Marshmallow, but NOT on my new Galaxy S5 Neo with Android version 5.1.1 Basically when I take a picture it never returns back on the page from where I started the process; always returns back to the initial home page. On devices where it works, when I take a picture, I see that first of all the application fires OnSleep, then after taking the picture fires OnResume. On my device where is NOT working it fires OnSleep and after taking the picture doesn't fire OnResume, it fires the initialization page and then OnStart. For this reason it doesn't open the page where I was taking the picture. What should I do to make sure it fires OnResume returning to the correct page and not OnStart which returns on initial fome page ?

In addition, when I take a picture it takes almost 30 seconds to get back to the code after awaiting TakePhotoAsync process, and it's too slow!

Curiosity.. when debuggin, if I put a break point on "Xamarin.Android MainApplication.cs" on "OnActivitySaveInstanceState" (without changing any code, just the beark point) then it works and come back to the right page after taking the photo. Executing the same code without stopping for a second on the break point then it doesn't work..

Please help !!! Thank you in advance .

SharpMobileCode commented 8 years ago

I'm seeing some similar behavior on a Verizon Samsung Galaxy S5. But in my case, it's acting like it's restarting my app and going to the same activity from where TakePhoto was called from. I can tell it's restarting because I can see MvvmCross being re-initialized in the Log Cat.

SharpMobileCode commented 8 years ago

@schiari I'm not sure if my issue is related to yours, but they sound very similar (see my comment above). After a few hours of troubleshooting and Googling, I found an article with Java/Android users have similar issues. As it turns out, there is some sort of bug on the Samsung Camera App if Low Light Detection is turned on. If Low Light Detection is turned on, it would re-set/restart my app.

However, if you go to settings of the Samsung Camera app, and then disable "Low Light Detection", my app worked as expected without crashing or restarting my app. Give this a shot to see if this is the issue.

If so, I really don't have a good solution as this is a bug in the Samsung Camera App. This was running on a Verizon Galaxy S5 on Android 5.0.

schiari commented 8 years ago

@SharpMobileCode thank you for your help. I will check this out.

jamesmontemagno commented 8 years ago

This issue was moved to jamesmontemagno/MediaPlugin#11