diff --git a/android-plugin/src/main/java/ru/mobilap/firebaseanalytics/FirebaseAnalytics.java b/android-plugin/src/main/java/ru/mobilap/firebaseanalytics/FirebaseAnalytics.java index 12c61a2..466ba8b 100644 --- a/android-plugin/src/main/java/ru/mobilap/firebaseanalytics/FirebaseAnalytics.java +++ b/android-plugin/src/main/java/ru/mobilap/firebaseanalytics/FirebaseAnalytics.java @@ -22,13 +22,11 @@ public class FirebaseAnalytics extends GodotPlugin { private final String TAG = FirebaseAnalytics.class.getName(); //final private SignalInfo loadedSignal = new SignalInfo("loaded"); - private Godot activity = null; private boolean _loaded = false; private com.google.firebase.analytics.FirebaseAnalytics fa; public FirebaseAnalytics(Godot godot) { super(godot); - activity = godot; init(); } @@ -55,7 +53,7 @@ public View onMainCreate(Activity activity) { } private void init() { - fa = com.google.firebase.analytics.FirebaseAnalytics.getInstance(activity); + fa = com.google.firebase.analytics.FirebaseAnalytics.getInstance(getActivity()); } public void logEvent(final String event, final Dictionary params) { diff --git a/nativelib.json b/nativelib.json index 66c37f7..c0ab874 100644 --- a/nativelib.json +++ b/nativelib.json @@ -2,7 +2,7 @@ "name": "firebase-analytics", "display_name": "Firebase Analytics", "description": "Firebase Analytics plugin (also supports Google Analytics with Firebase account)", - "version": "0.1.1", + "version": "0.1.2", "godot_version": "3.2.3", "license": "MIT", "url": "https://github.com/DrMoriarty/godot-firebase-analytics", diff --git a/scripts/fba.gd b/scripts/fba.gd index 445080b..e5ce91f 100644 --- a/scripts/fba.gd +++ b/scripts/fba.gd @@ -8,9 +8,12 @@ var _fba = null # User property names: sign_up_method (str) func _ready(): - if type_exists('FirebaseAnalytics'): + if(Engine.has_singleton("FirebaseAnalytics")): + _fba = Engine.get_singleton("FirebaseAnalytics") + print('FirebaseAnalytics plugin inited!') + elif type_exists('FirebaseAnalytics'): _fba = ClassDB.instance('FirebaseAnalytics') - + print('FirebaseAnalytics plugin inited!') func screen(name, screen_class='Godot'): # log game screen