Giter VIP home page Giter VIP logo

Comments (8)

nkalupahana avatar nkalupahana commented on May 28, 2024

Have you set the following permissions in your AndroidManifest.xml?

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

If so, are you able to reproduce the same error on the example app in the example/ folder of this repo?

from media.

beliven-francesco-delgiudice avatar beliven-francesco-delgiudice commented on May 28, 2024

Yes, I have those permissions in the android/app AndroidManifest.xml (first screenshot).

When it comes to the example/ folder, I encountered two problems:

  1. Module not found: Error: Can't resolve '@capacitor-community/media' in '/Users/francesco.delgiudice/Downloads/media-master/example/src/components' in the terminal on ionic cap sync android (second screenshot)
  2. Caused by: org.gradle.api.resources.MissingResourceException: Could not read script '/Users/francesco.delgiudice/Downloads/media-master/example/android/capacitor-cordova-android-plugins/cordova.variables.gradle' as it does not exist. in Android Studio while builiding/running the app (third screenshot).

Am I missing something?

Screenshot 2023-09-18 alle 09 57 02 Screenshot 2023-09-18 alle 10 03 36 Screenshot 2023-09-18 alle 10 05 30

from media.

nkalupahana avatar nkalupahana commented on May 28, 2024

Run npm install and npm run build in the root directory first, and then go to the example directory and run npm install and ionic cap sync.

from media.

beliven-francesco-delgiudice avatar beliven-francesco-delgiudice commented on May 28, 2024

Oh ok, I didn't know I had to build the root directory and I didn't read it in the README.

Anyway, the example folder works flawlessly but as shown in the screenshot I'm using the methods in the same way so I don't understand what I am doing wrong.

The first time I try to save it asks the user for permission and, even if granted, it doesn't save the image.
The second time it does save the image (since now it has the permissions to do it) but crashes (maybe tries to follow through and show the folder like in your example folder) or sometimes it doesn't crash but doesn't follow through, simply saving the image.

Do you have maybe other tips?

from media.

nkalupahana avatar nkalupahana commented on May 28, 2024

Media.createAlbum() does not return an album object, so that part of your code might be causing issues. You have to getAlbums() after creating an album. Let me know what the behavior is after that, and share your new code, and we can go from there.

from media.

beliven-francesco-delgiudice avatar beliven-francesco-delgiudice commented on May 28, 2024

This is the code right now. It seems to be working sometimes (so a little bit better than before I guess) but the console.log aren't working so I am still confused

Screenshot 2023-09-20 alle 11 33 06

from media.

nkalupahana avatar nkalupahana commented on May 28, 2024

Honestly, this code looks fine, so I'm not sure. However, this is almost certainly a problem with your specific configuration, since I've tested this on multiple devices and the emulator and it works. If you can share a minimal reproducible example in a repo (minimal app with the bug), I can debug this directly. (Or if you've already fixed it, or moved on, please let me know!)

from media.

beliven-francesco-delgiudice avatar beliven-francesco-delgiudice commented on May 28, 2024

I couldn't find a bug and it still didn't work so clearly something in the configuration isn't working properly but I can't manage to find it since everything else works. At a certain point I gave up and found a different way to download the images without using a library. Thanks anyway

from media.

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.