public static void initializeOnStartup(final String folderName, final String appName, final long GUID) {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
try {
CustomMessageDispatcher daemon = new CustomMessageDispatcher();
// Check if this application registered folders already
ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
if (reg.getApplicationFolder(CustomMessageInterface.INBOX_FOLDER_ID) == null) {
// Register folders & message types and initialize
// folders
daemon.init(folderName, appName, GUID);
}
} catch (Exception e) {
throw new RuntimeException("CustomMessage.initializeOnStartup() error: "
+ e.getMessage());