You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to work in background (with popup notification if someone tries to share a file) #185
Could you add option for the app to work in background?
I've been using it to send files between work profile and main profile, but since v1.9.1 if the app is not in foreground it disconnects from server so switching back and forth between apps does not work anymore.
Describe alternatives you've considered
Using older versions of the app or using from browser will work.
Yes, the problem is that android activities aren't designed to run in the background.
One solution might be to create a ViewModel/LiveData backed implementation and start a background service with the same webview instance as soon as the activity is paused. Not sure if this will really work though...
Better would be a Foreground Service with a running notification*
On the other hand i'm not really sure its worth it, you can just open the app like once and start sending files, which you would have to do anyway for accepting files.
changed the title [-]Option to work in background[/-][+]Option to work in background (with popup notification if someone tries to share a file)[/+]on Jun 16, 2024
Activity
fm-sys commentedon Mar 16, 2022
Yes, the problem is that android activities aren't designed to run in the background.
One solution might be to create a ViewModel/LiveData backed implementation and start a background service with the same webview instance as soon as the activity is paused. Not sure if this will really work though...
https://medium.com/@nicholas.rose/keeping-webview-state-across-configuration-changes-8e071ee9de86
https://medium.com/@oriharel/how-to-run-javascript-code-in-a-background-service-on-android-8ec1a12ebe92
WIP background mode (rel. to #185)
WIP background mode (rel. to #185)
ueen commentedon Jun 25, 2022
Better would be a Foreground Service with a running notification*
On the other hand i'm not really sure its worth it, you can just open the app like once and start sending files, which you would have to do anyway for accepting files.
If you actually do want to pursue this heres a start
1.) create foreground service with notification
https://developer.android.com/guide/components/foreground-services
2.) include webview
https://stackoverflow.com/questions/39038771/calling-javascript-from-service-android
3.) proabably best would be just to run the network.js and connect.js you can be inspired by my firefox addon which is basiclly doing the same (running a stripped down version for the background mode - checkout background.js)
https://github.com/ueen/SnapdropFirefoxAddon
if a file is send the app probably should be opened, but consider restrictions on starting activities
https://developer.android.com/guide/components/activities/background-starts
[-]Option to work in background[/-][+]Option to work in background (with popup notification if someone tries to share a file)[/+]fm-sys commentedon Jul 27, 2024
Marking as won't fix, at least I won't work on it myself cause of potential battery drain and very difficult implementation.