Once upon a time I uploaded a Delphi sample app to the Google Play Store, written in Delphi XE5 and implementing an Android service. I wrote about the published app in this post and supplied the source in this follow-up post.
There was an issue that’s been hanging around with that sample project. When pulled into Delphi XE7 and updated so it all compiled nicely, it didn’t play ball when deployed. Instead it hung.
I’ve eventually worked through the to-do list enough to take a look at the problem. For one reason or another starting the service in the OnCreate event handler caused an issue thanks to some required thread synchronisation, which no longer functions as I wanted it to.
I’ve worked around the problem by very slightly delaying the service starting by use of a one-shot timer. Then the form setup is done and dusted by the time the service is invoked and all seems to be well.
An updated download archive is available here, which contains the original Delphi XE5 project and a Delphi XE7 equivalent, which should now be functionally equivalent.