I need to write some service for android, using delphi XE5 (firemonkey). That service need to run in backgroung and periodically read sms inbox, writing it into sqllite DB (sms backup).
I know how to read sms and how to write it to DB, but I have no idea how to make app work in background as service.
Any ideas?
P.S.: Thank you for your answers. P.P.S.: Sorry for my bad english.
You cannot do that with XE5 alone but you can do it with a little help from Java.
Brian Long has published a two-parter on this topic:
http://blog.blong.com/2013/11/delphi-and-android-services.html
http://blog.blong.com/2013/11/delphi-and-android-services-part-2.html
Android services are not the same as Windows services. If you do use an Android service, it still runs in your application's main thread. They stop when the device enters sleep mode. Also, the system can terminate the service in low memory and possibly other situations.
From the documentation:
and
Instead of services, the AlarmManager might be a better choice. That is a system service, which will execute actions when you'll tell, for example periodically.