Actually a FormService IS an Android service. That's the class it extends. Sure there are methods like a Form, but those are there for simplicity's sake (and a service is close to an Activity in how it operates, in fact they both extend the Context class).
The code in that link looks fine. I don't think the issue is the Mail class.
One thing you could try is running the service in the foreground. This will allow the service to run as if it's in the foreground when the app is not. This requires a notification to be placed in the device's notification bar.
I'll be adding a method to call this easily (actually I have already, but my copy of the bridge is kind of in flux at the moment).
Here's the method if you want to try it out:
/**
* Use this method to set this service as a Foreground service. This means it will behave
* as if it is in the foreground, even if the app is not. This will consume more battery,
* so use this wisely. Also, a notification is placed in the notification bar (this is required),
* hence the need for the text, and icon res it.
*
* @param iconResId The resource ID of the icon you wish to display in the notification
*
* @param titleText The title of the notification.
*
* @param tickerText The text which shows in the notification bar when a notification is first
* displayed.
*
* @param msgText The text that is displayed in the notification when vieweing current notifications
*
* @param classToOpen The class to open when the notification is clicked.
*/
@SuppressWarnings("deprecation")
public void ForeGround(int iconResId, String titleText, String tickerText, String msgText, Class<?> classToOpen) {
Notification note = new Notification(iconResId, tickerText, System.currentTimeMillis());
Intent intent = new Intent(this, classToOpen);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
note.setLatestEventInfo(this, titleText, msgText, pIntent);
startForeground(FOREGROUND_ID, note);
}
Ryan