Forum Xamarin.Android

What is the lifetime of a thread?

t2117328t2117328 Member ✭✭

I want to run a long-live operation inside a seperate thread. My question is, what is the lifetime of a thread in Android?



  • EspectrosEspectros Member ✭✭
    edited May 2018

    It lasts the time that it takes to run the code that has inside.

  • jennyolsenjennyolsen Member ✭✭
    edited May 2018

    Runtime of thread is depended on the code present in the thread.
    If there is any code like background service which updates gps location every 2 seconds, thread will never come to end.
    Or it may be ended as described in thread's code structure.

  • t2117328t2117328 Member ✭✭

    Well, the thing is that, when i place a long running operation inside the thread, it gets ended after a while. My question is, WHY?

    In windows application, i call StartStreamMatchingAllConditionsAsync() method and it works fine until i cancel it, but in my android app it doesn't.

    btw, the long running operation is Tweetinvi's method "StartStreamMatchingAllConditions()" inside a BackgroundWorker.

  • t2117328t2117328 Member ✭✭

    Found out that the problem was caused by the OS battery saving feature, disabling it made the app function normally.

Sign In or Register to comment.