D16491: Allow shares to be canceled

Erik Duisters noreply at phabricator.kde.org
Tue Oct 30 10:48:18 GMT 2018


eduisters added a comment.


  In D16491#350751 <https://phabricator.kde.org/D16491#350751>, @nicolasfella wrote:
  
  > BackgroundJob looks line https://developer.android.com/reference/android/os/AsyncTask to me. Can we use that instead of creating our own thing?
  
  
  You could but because there are so many issues with AsyncTask I would not recommend it (its even not recommended for running tasks that take longer than a few seconds).
  Using BackgroundJob and BackgroundJobHandler also allows to start jobs from non Activities. Regarding orientation changes the same problems remain, we have to make sure that updates to the UI are done on the newly created activity/fragment not the old ones (The 2 I use only update a notification so no problems there).
  
  Current best practices are using ViewModels that are retained and LiveData that deliver data to the activity/fragment only when the lifecycle permits it. So ViewModel starts a BackgroundJob and is guaranteed to receive the result updates the LiveData with the result and then when the Activity observing the LiveData becomes active it will receive the result.

REPOSITORY
  R225 KDE Connect - Android application

REVISION DETAIL
  https://phabricator.kde.org/D16491

To: eduisters, #kde_connect, nicolasfella
Cc: nicolasfella, kdeconnect, skymoore, wistak, dvalencia, rmenezes, julioc, Leptopoda, timothyc, jdvr, yannux, Danial0_0, johnq, Pitel, adeen-s, SemperPeritus, daniel.z.tg, jeanv, seebauer, bugzy, MayeulC, menasshock, tctara, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20181030/a843cb8c/attachment-0001.html>


More information about the KDEConnect mailing list