2

I have a requirement where I need to read only 100 entries per day from an excel file. The file can have thousands of records.

I wish to create the system in android where a scheduled service will run every day at a pre defined time and read the next set of 100 records and do further processing on them.

Once all rows from the excel file are over, the scheduled service needs to cancel itself.

While reading on the forums, I came across discussions revolving around Timer task Alarm manager

Can anyone let me know which of these should be preferred and why? Also point out if any other efficient way of doing this exists.

I plan to make this work from android 2.1+ versions.

1985percy
  • 433
  • 1
  • 5
  • 8

1 Answers1

2

Using alarm manager is the only way to have your scheduled task being performed even if the application goes in background and the os revokes its resources.

Any other option that involve creating local threads objects or alternatives of this kind may work in short term, but would not be a robust solution.

TimerTask must be instantiated.

Any object instance belonging to your application may be canceled together with your app when it goes in background, looses priority and Android frees its resources.

fedepaol
  • 6,834
  • 3
  • 27
  • 34