Sometimes after long periods of using my application, when I try to enable it, I get ANR. In the Google Play console, I get the following:
ANR Executing service my.site.app/com.google.android.gms.analytics.AnalyticsService
Obviously, the problem is in the AnalyticsService . But I could not play ANR while my device was connected to my computer. And I do not see ANR in the analytic account.
This is my application class:
public class BaseApp extends Application { public static GoogleAnalytics analytics; public static Tracker tracker; @Override public void onCreate() { analytics = GoogleAnalytics.getInstance(this); analytics.setLocalDispatchPeriod(1800); analytics.setDryRun(Constants.IS_DEBUG); GoogleAnalytics.getInstance(this).getLogger().setLogLevel(Logger.LogLevel.VERBOSE); tracker = analytics.newTracker(Constants.GOOGLE_ANALYTICS_TRACKER_ID); tracker.enableExceptionReporting(true); tracker.enableAdvertisingIdCollection(true); tracker.enableAutoActivityTracking(true); super.onCreate(); } }
And then in my BaseActivity class:
@Override public void onStart() { super.onStart(); sendScreenStat(); } protected String getScreenStatName() { return getTitle().toString(); } private void sendScreenStat() { BaseApp.tracker.setScreenName(getScreenStatName()); BaseApp.tracker.send(new HitBuilders.ScreenViewBuilder().build()); }
What could be the reason?
source share