From c790ee611dd3cd8650b37d8ee7b076c9dec7c616 Mon Sep 17 00:00:00 2001 From: Erik Johansson Date: Sun, 24 Jun 2018 21:42:56 +0200 Subject: [PATCH] Hold on to OpenScale instance in the Application instance Hopefully fixes #294. --- .../src/main/java/com/health/openscale/core/Application.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/android_app/app/src/main/java/com/health/openscale/core/Application.java b/android_app/app/src/main/java/com/health/openscale/core/Application.java index 87e6bb98..cb006941 100644 --- a/android_app/app/src/main/java/com/health/openscale/core/Application.java +++ b/android_app/app/src/main/java/com/health/openscale/core/Application.java @@ -21,6 +21,7 @@ import com.health.openscale.BuildConfig; import timber.log.Timber; public class Application extends android.app.Application { + OpenScale openScale; private class TimberLogAdapter extends Timber.DebugTree { @Override @@ -40,5 +41,8 @@ public class Application extends android.app.Application { // Create OpenScale instance OpenScale.createInstance(getApplicationContext()); + + // Hold on to the instance for as long as the application exists + openScale = OpenScale.getInstance(); } }