Atul Bhardwaj
Atul Bhardwaj

Reputation: 6717

Should We use Handler for long delay Android

I am using Handler in service and using it's method handler.sendMessageDelayed(message,time). This method is working fine for short period of time but not working(sometimes) for long time like 3,5,10 minutes.Should I use handler for such long delays?

Upvotes: 0

Views: 294

Answers (2)

Snow Albert
Snow Albert

Reputation: 577

No, it will only take a few minutes. But when you set some hour, especially when you set something delayed and it happens tomorrow. Form my app dev, the cross day Handler thread, will have minutes to hours gap from expect to reality. Finally, I use alarm manager and test JobSchduler. It's all precise work. And finally, I use alarm manager.

Upvotes: 0

Tomislav Novoselec
Tomislav Novoselec

Reputation: 4620

Probably not. You should look into AlarmManager to execute some task in the future.

http://developer.android.com/reference/android/app/AlarmManager.html

Upvotes: 1

Related Questions