Search code examples
androidftpalarmmanager

How to schedule an Android FTP upload and download at timed intervals?


I am developing an activity that on the press of a button, downloads a text file from a remote server via FTP containing several numbers. On the press of another button, a text file is created with various stats depending on the numbers (CPU useage, SD card free space etc) and FTP'd back to the same server.

All this is working fine, but the next stage of development is to make the app do all this at timed intervals, all in the background without showing the GUI (which will only be used for setup).

I've never done this before, so I had a dig around on the web, it seems I will need to use Alarm Manager, but I don't have a clue where to start. Can someone point me in the right direction please? It would be helpful if someone could give me an answer that ties in with my particular problem rather than saying "go and look on so-and-so Android website".


Solution

  • For background things read: http://developer.android.com/reference/android/app/Service.html If you want to do this with intervals you can use: http://developer.android.com/reference/android/app/AlarmManager.html