What is the best approach to perform a background task?

MikeDennisMikeDennis ✭✭USMember ✭✭

Current Scenario: user will keep adding item from the Xamarin.Forms - > On every add there should be a background process carried out which will take around 30secs, during this period user should be allowed to perform the operation. basically a queue structure without blocking the user in android

Answers

  • MikeDennisMikeDennis ✭✭ USMember ✭✭

    @AdamP any idea on this question?

  • MikeDennisMikeDennis ✭✭ USMember ✭✭

    Tried using the intent service but it blocks the main UI...

  • AdamPAdamP ✭✭✭✭✭ AUUniversity ✭✭✭✭✭

    @MikeDennis - if its only taking around 30 seconds and it doesn't interact with the UI at all, then I would recommend you use Task.Run(async ()=> {});

    This will run the task on a different thread than the UI.

  • Maharshi.5212Maharshi.5212 ✭✭ USMember ✭✭

    @MichaelRidland
    I tried to run a forms application on windows RT and there are some background tasks.
    I used Task.Run(async ()=> {}) for android. It was throwing an exception in windows rt when I try to use Task.Delay . Like Property nameRoot is not null.

    How to use Task.Delay in windows rt environment.

Sign In or Register to comment.