Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about compatibility with Android #65

Open
AndroidDeveloperLB opened this issue Jul 11, 2019 · 3 comments
Open

Questions about compatibility with Android #65

AndroidDeveloperLB opened this issue Jul 11, 2019 · 3 comments

Comments

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented Jul 11, 2019

From my understanding by reading the description, this library can be used to guess the type of a file based on its content, similar to the "file" command on linux.

  1. Am I correct?
  2. Could this also work on Android? If so, from which version?
  3. Is it possible to use it via Gradle? If so, what is the dependency I need to add? Is there a way to get updated about the version ? Maybe here?
  4. How much space does it add to the app's size?
  5. Where can I see all of the supported mime-types that it can return? Does it have support for those that are supported by Android (here) ?
@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Jul 12, 2019

OK was curious and tried it myself.

gradle:

implementation 'com.j256.simplemagic:simplemagic:1.16'

Code:

        AsyncTask.execute {
            val util = ContentInfoUtil()
            val input = URL("https://img.freepik.com/free-vector/abstract-dynamic-pattern-wallpaper-vector_53876-59131.jpg?size=338&ext=jpg").openStream()
            val info = util.findMatch(input)
            Log.d("AppLog", "info:$info")
        }

And the result:

info:jpeg, type JPEG, mime 'image/jpeg', msg 'JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16'

So to answer the questions:

  1. Seems so.
  2. Working even on Android Q beta 5. Tested also on emulator with Android API 16 (4.1).
  3. Yes. But not sure about updates. Just need to check from time to time on the website, I guess.
  4. Seems not to add much. The app became 2,522KB in side, and was 2,347KB . Rising in just ~200KB, and might be smaller when used with R8 minimizer. I wonder how much it reads from the InputStream and if it can be checked somehow, and how efficient it is. Probably very efficient and barely reads data.
  5. This I don't know yet.

Attached here the tiny sample project.

My Application.zip

Good job on this library!

@j256
Copy link
Owner

j256 commented Jul 12, 2019

Thanks @AndroidDeveloperLB . I need to add Gradle support to all of my libraries. Sigh. So much to do.

@AndroidDeveloperLB
Copy link
Author

@j256 Can you please confirm and/or answer what I wrote ?

Is there a list somewhere of all the file-types that you support?
Does it at least include those that Android support (probably so) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants