When sending image to database, app crashes. Works fine for other data RRS feed

  • Question

  • User361594 posted

    I am developing a mobile app using Xamarin vs2017 C# which uploads some data to an online server with web request. The app works perfect on the VS Emulator and crushes in some cases when testing the apk on mobile phones.

    To make things more clear, it will be better to list the similar problems I faced and are already solved. The app accesses pictures from gallery, uploads the chosen image [as byte array] and other text such as name to an online server using internet connection.

    First, when it reached to the steps that it accesses the internet, it crashes. This was solved by giving the app permission to access INTERNET in Android Manifest.

    Second, when it reached to the steps it accesses the gallery, it crashes. This was also solved by giving the READEXTERNALSTORAGE permission in Android Manifest.

    Now, after converting the image from gallery to a byte array, at the steps it uploads it to an online hosted database, it crashes. Other text data are submitted and stored successfully to the database. The problem is only when submitting the byte array image. In addition, it works fine with the emulator and stores images to the online database. I think this is also an Android Manifest permission issue and until now I couldn't find solution online.

    Please point me out on what to do.

    Thank you!

    Sunday, March 11, 2018 11:33 AM

All replies

  • User354535 posted

    Please post your call upload image and your "Crash Log" here.

    Monday, March 12, 2018 7:24 AM
  • User361594 posted

    Hi Lang, Thanks for your concern. When I try it with smaller pictures, it worked. So now the problem is the size. I gotta make some scaling down!!! Thanks

    Monday, March 12, 2018 7:54 AM