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

Performing download in the same activity rather than a different one #112

Open
chipbell4 opened this issue Aug 30, 2017 · 1 comment
Open

Comments

@chipbell4
Copy link

Is there any particular android limitation that forces the downloader process to be started and ran from a second Activity? Would it be possible for the Service to be started from the main plugin instance and managed there.

The reason I ask it that I could see it beneficially for integrators to be able to display progress however they want in their cordova-based HTML UI. I could see the plugin simply emitting events to interested listeners and notifying when it's done:

window.xapkreader.on('progress', (evt) => {
  document.getElementById('progress-bar').innerHTML = evt.percentage
});
window.xapkreader.on('finish', (evt) => {
  document.getElementById('progress-bar').style.visibility = 'hidden'; // or whatever
});
window.xapkreader.startDownload();

However, I am curious how to implement this giving the current branching model because it will possibly break the plugin for integrators on the old way of doing it. I'd be glad to take stab at it, but I first wanted to get some feedback on some of these issues and perhaps a some guidance on how (and if) you'd like to see it written.

Thanks!

@agamemnus
Copy link
Owner

agamemnus commented Aug 30, 2017

Is there any particular android limitation that forces the downloader process to be started and ran from a second Activity? Would it be possible for the Service to be started from the main plugin instance and managed there.

Probably not... might need a lot of code work, though.

As long as it doesn't break backwards compatibility, feel free to work on the 6.5 branch. It wouldn't be a good idea imo to create two versions of this plugin for one version of Cordova. You could add a flag (default 0?) or something. It's (almost?) the same as 5.3.1-auto.

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