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

Server still disconnects when transferring APK file on Android phone #76

Closed
1 of 4 tasks
efung opened this issue Aug 15, 2018 · 16 comments
Closed
1 of 4 tasks

Server still disconnects when transferring APK file on Android phone #76

efung opened this issue Aug 15, 2018 · 16 comments

Comments

@efung
Copy link

efung commented Aug 15, 2018

I'm opening this issue because:

  • I have found a bug

  • I want to request a feature

  • I have a question

  • Other

  • My Go version is: go version go1.10.3 darwin/amd64

  • My GOPATH is set to: ~/go

I'm using the latest version of the tool (I ran go get … last night) and saw that #13 was supposed to be resolved.

But I continue to experience problems.

I'm trying to transfer an APK file to an Android device. When I scan the code with, say, Zxing, Google Assistant/Lens, or even Twitter, I get redirected to a browser, which gives me a popup warning that the file is potentially harmful (since it's an application not downloaded from Google Play store). The connection drops at that point. Sometimes a partial download occurs. (I'm guessing the browser application downloads the file in the background, while the user answers the prompt.)

Is there anything I can do, to help you diagnose this issue?

@claudiodangelis
Copy link
Owner

claudiodangelis commented Aug 15, 2018 via email

@claudiodangelis
Copy link
Owner

I'm able to reproduce the issue and agree with what you've guessed.

As a quick workaround you can zip it before transfer, you can do that by passing the -zip flag:

qr-filtransfer -zip your.apk

@rafa-acioly
Copy link
Contributor

the browser is canceling the download because it is a apk? i don't understand it.

@efung
Copy link
Author

efung commented Aug 16, 2018 via email

@efung
Copy link
Author

efung commented Aug 16, 2018

As a quick workaround you can zip it before transfer, you can do that by passing the -zip flag:

Android can't natively handle ZIP files. The end goal is to be able to install an APK directly.

@brualan
Copy link
Contributor

brualan commented Aug 18, 2018

@efung you can comment out lines 66-69 in serveHTTP.go. After that, the server will continue to work as long as you want, but you will need to manually shutdown it.

@claudiodangelis How about adding a flag on which the server will work as much as the user wants?

@efung
Copy link
Author

efung commented Aug 20, 2018

I'll try that workaround, and like the idea of a flag to control whether the server is kept alive. It could even have a potential use-case of allowing you to transfer the same file to multiple devices.

But I'm still curious as to why the download is being aborted.

@claudiodangelis
Copy link
Owner

I'm adding the -keep-alive flag, sending you updates soon

@claudiodangelis
Copy link
Owner

claudiodangelis commented Aug 20, 2018

Please check out PR #78

git fetch origin
git checkout -b keep-alive origin/keep-alive
git merge master
go build
./qr-filetransfer -keep-alive=true /path/to/unknown-origin.apk

@efung
Copy link
Author

efung commented Aug 20, 2018

Hmm. I'm not sure what's going on: I followed that script to execute qr-filetransfer from the PR branch. The first time, I didn't specify any -keep-alive flag at all, and was able to succesfully download APKs to my Android device. I repeated using a different QR code app, and was successful again. I tried a third time, using -keep-alive=false, and was still successful. And if I specify -keep-alive=true, I can verify that the server is kept alive so that I can transfer again.

Not sure why the connection is being cooperative now, as opposed to last week. Perhaps I wasn't correctly installing the binary with the fix to #13 in it? Or perhaps some other change in this PR is making the transfer more reliable? ¯\_(ツ)_/¯

@claudiodangelis
Copy link
Owner

claudiodangelis commented Aug 20, 2018 via email

@claudiodangelis
Copy link
Owner

Any updates @efung? PR #78 apparently fixes the problem for me, but it would be great if you could confirm as well.

If everything is OK, please feel free to close this issue, thank you!

@efung
Copy link
Author

efung commented Aug 23, 2018

I've tried on two different WiFi networks, and there's no consistent pattern. Sometimes, the APK is transferred fully, sometimes not.

But with the -keep-alive=true flag, I am always successful!

@claudiodangelis
Copy link
Owner

Sounds like an "issue fixed" to me! Please feel free to reopen the issue if it needed.

@efung
Copy link
Author

efung commented Aug 23, 2018

(BTW, you can put Resolves #76 in the PR #78 and it will auto-close this issue, when the PR is merged)

@claudiodangelis
Copy link
Owner

Oooh, I forgot about that trick. Thanks!

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

4 participants