Having the algorithms at hand from the Astro module (see
http://www.b4x.com/forum/share-your-creations/4110-sun-amd-moon-data-gps-programs.html#post23730) I made this library which does the same as the module:
Sunrise and sunset times
Moonrise and Moonset times
Moonphase
The file includes the library, the source (cs file) so it is integrated at compilation, and a demo program that works without GPS, but the use of this library is meant for GPS to supply the coordinates and date. The second form in the demo program is actually what I use in mine.
There is also documentation.
(Please don't ask me about the algorithms - I can't explain how they work)