Whenever your application receives a new notification, the Application method will be called OnCreate().
Not only a notification, even if you are subscribing to system events such as ACCESS_WIFI_STATE, ACCESS_NETWORK_STATE, RECEIVE_SMS, RECEIVE_BOOT_COMPLETED .. OnCreate () will be called.
Therefore, OnCreate()do not make any calls to Google Analytics within your application . This will initialize your GA and begin tracking events.
Remove Google Analytics-related codes within the application OnCreate()to prevent unwanted event tracking.
Update:
https://developers.google.com/analytics/devguides/collection/android/v4/advanced
getInstance ( )
GoogleAnalytics, .
; . , GoogleAnalytics, .
Application, mTracker .
private Tracker mTracker = null;
public synchronized Tracker getDefaultTracker() {
if (mTracker == null) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
mTracker = analytics.newTracker(Config.GA_TRACKING_ID);
mTracker.enableAutoActivityTracking(true);
mTracker.enableExceptionReporting(true);
mTracker.setSessionTimeout(SESSION_TIMEOUT);
}
return mTracker;
}
, .