Oh, just read that you want to make an Extension.
Probably there is no way to add custom application class from extension (moreover I believe that it is bad idea to modify application class from extension).
Previous answer:
OpenFL / Lime didn’t use custom application class. You should create it by yourself.
- Override android template, to do it put
<template path="templates" />
inside project.xml
-
inside
templates
folder create following folders:android/template/app/src/main/java/org/haxe/lime
-
copy
AndroidManifest.xml
from Lime (https://github.com/openfl/lime/blob/develop/templates/android/template/app/src/main/AndroidManifest.xml) totemplates/android/template/app/src/main
-
create
MainApplication.java
insidetemplates/android/template/app/src/main/java/org/haxe/lime/
-
Project structure should be like that:
root_of_project/
|- ...
|- templates/
| |- android/
| |- template/
| |- app/
| |- src/
| |- main/
| |- java/
| | |- org/
| | | |- haxe/
| | | | |- lime/
| | | | | |- MainApplication.java
| |- AndroidManifest.xml
|- project.xml
- in
AndroidManifest.xml
find<application ...>
tag, and addandroid:name=".MainApplication"
somewhere:
<application android:name=".MainApplication" ...>
- open
MainApplication.java
, and put following inside:
package org.haxe.lime;
import android.app.Application;
import android.content.Context;
import org.acra.*;
import org.acra.annotation.*;
@ReportsCrashes(formUri = "http://www.backendofyourchoice.com/reportpath")
public class MainApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
ACRA.init(this);
}
}
P. S. I didn’t test it, but I believe that it should work.