Git Product home page Git Product logo

Comments (7)

rotter avatar rotter commented on August 31, 2024 1

I think your suggestion has fixed my problem, crashes seem to have vanished recently, but I'm not completely sure yet, let me run it for a couple more days and I will write back

from unitynativegallery.

yasirkula avatar yasirkula commented on August 31, 2024

Which function do you use to access the file in ProcessSelectedFilePath? Also, does it say which Android versions this error occurs on?

from unitynativegallery.

rotter avatar rotter commented on August 31, 2024

The code on my side that triggers the exception:
FileStream selectedFile = File.Open(selectedFilePath, FileMode.Open);

Regarding versions I've checked about 20 stack traces and the versions seen were Android 5, 6 and 7.

And from what I see in the stack traces there are 2 flows that get to this point/exception:

  1. When the user dont have the permission initially, I ask for it, and then on "Update" after the permission flag is on I call "GetImageFromGallery"
  2. When the user has already given the permission in the past, so I simply call "GetImageFromGallery" directly

Obs: I'm rolling out a major update on my app (which includes adding your plugin), so if you need me to add any code/tests on the flow just let me know and I will do it, I will certainly release many new updates today and on the next days

from unitynativegallery.

yasirkula avatar yasirkula commented on August 31, 2024

You can try the following:

FileStream selectedFile = File.Open(selectedFilePath, FileMode.Open, FileAccess.Read);

Adding FileAccess.Read to File.Open helped me get rid of similar exceptions on a standalone Unity game in the past. Maybe the same applies to Android, as well.

P.S: Or you can try other functions like File.Copy and so on.

from unitynativegallery.

rotter avatar rotter commented on August 31, 2024

Thanks, I will try that!

from unitynativegallery.

rotter avatar rotter commented on August 31, 2024

I think it's solved! Thanks a lot!

from unitynativegallery.

yasirkula avatar yasirkula commented on August 31, 2024

You are welcome! Hope the issue is indeed solved for good.

from unitynativegallery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.