Skip to content
Permalink
Browse files

Create gmdevbloggamemakerfirebasecrashlytics.java

Added version 1.0.5
  • Loading branch information...
Fritsbie committed Apr 17, 2019
0 parents commit aff7da9c5dbf038d1881255bf58d7315f4322055
Showing with 89 additions and 0 deletions.
  1. +89 −0 android/gmdevbloggamemakerfirebasecrashlytics.java
@@ -0,0 +1,89 @@
package ${YYAndroidPackageName};

//Game Maker Studio 2 Packages
import ${YYAndroidPackageName}.R;
import com.yoyogames.runner.RunnerJNILib;
import ${YYAndroidPackageName}.RunnerActivity;

//Some Java & Android Packages
import java.lang.String;
import android.util.Log;

//Firebase Crashlytics Packages
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;

public class gmdevbloggamemakerfirebasecrashlytics extends RunnerActivity {


//Debug Modifier
public static boolean debModdie = false;

public void firebase_crashlytics_debug_mode(double arg0) {

//You might ask wtf is this code. With this function, I imitate converting GML boolean to Java boolean.
if (arg0 >= 0.5)
{
debModdie = true;
}
else
{
debModdie = false;
}


}

public void firebase_crashlytics_set_string(String arg0, String arg1) {

Crashlytics.setString(arg0, arg1);
}

public void firebase_crashlytics_set_real(String arg0, double arg1) {

Crashlytics.setDouble(arg0, arg1);
}

public void firebase_crashlytics_set_bool(String arg0, double arg1) {

if (arg1 >= 0.5)
{
Crashlytics.setBool(arg0, true);
}
else
{
Crashlytics.setBool(arg0, false);
}

}

public void firebase_crashlytics_set_userid(String arg0) {

Crashlytics.setUserIdentifier(arg0);
if (debModdie==true)
{
Log.i("yoyo", "Game Maker Firebase | Crashlytics : User ID is set as " + arg0);
}
}

public void firebase_crashlytics_log(String arg0) {

Crashlytics.log(arg0);
if (debModdie==true)
{
Log.i("yoyo", "Game Maker Firebase | Crashlytics : Logged the message <" + arg0 + "> to the Crashlytics Panel.");
}
}

public void firebase_crashlytics_enable() {
// [START crash_enable_at_runtime]
Fabric.with(this, new Crashlytics());
// [END crash_enable_at_runtime]
if (debModdie==true)
{
Log.i("yoyo", "Game Maker Firebase | Crashlytics : Enabled crash listening.");
}
}


}

0 comments on commit aff7da9

Please sign in to comment.
You can’t perform that action at this time.