--- /dev/null
+#include <cstring>
+#include <msp/fs/path.h>
+#include "application.h"
+#include "errorlogger.h"
+#include "mainthread.h"
+
+using namespace std;
+
+namespace Msp {
+namespace Android {
+
+MainThread::MainThread(ANativeActivity *a):
+ activity(a)
+{
+ launch();
+}
+
+void MainThread::main()
+{
+ /* I have no idea how dependable this is, but it seems to be the only way
+ to get the package name aside from making a Java call through JNI */
+ char *appname = strdup(FS::Path(activity->internalDataPath)[-2].c_str());
+ char *argv[] = { appname, 0 };
+ Msp::Android::ErrorLogger err_logger;
+ Msp::Application::run(1, argv, activity);
+ free(appname);
+ ANativeActivity_finish(activity);
+}
+
+} // namespace Android
+} // namespace Msp