Skip to content

fix apk file open fails in some cases #103

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

Merged
merged 11 commits into from
Aug 15, 2019
Merged

Conversation

tearf001
Copy link
Contributor

@tearf001 tearf001 commented Aug 13, 2019

1. merge getOpenFileIntent and validateIntent to validatedFileIntent
when to comsume it,check the returning Indent is not null then run startAcitvity(validatedFileIntent)
2.In validatedFileIntent method,
if original contentType fails validateIntent, use URLConnection.guessContentTypeFromStream(inputFile) && URLConnection.guessContentTypeFromName(path) to get workable mimeType

WangXinhai added 10 commits August 13, 2019 01:02
some apk file's mimetype ends with charset,such as "application/vnd.android.package-archive;charset=utf8" which cause the indent `setDataAndType`  with wrong type. In my project, `validateIntent` will failed
merge `getOpenFileIntent` and `validateIntent` validatedFileIntent
getOpenFileIntent => validatedFileIntent
It works instead of removing the `charset` suffix
add [The try-with-resources Statement ensures each resource is closed] (https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html)
@tearf001
Copy link
Contributor Author

I have read a lots of documents about android/java recently,
it's hard to read and write so many java codes well,sorry about it.

@hnvn
Copy link
Member

hnvn commented Aug 15, 2019

It's OK, looks better, I will refactor some codes for you

@hnvn hnvn merged commit c44eac6 into fluttercommunity:master Aug 15, 2019
@hnvn
Copy link
Member

hnvn commented Aug 15, 2019

I've just updated your codes, let check it out and make sure it passed your case

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

Successfully merging this pull request may close these issues.

2 participants