use of com.google.android.gms.analytics.GoogleAnalytics in project qksms by moezbhatti.
the class AnalyticsManager method init.
public void init(Context context) {
if (LOCAL_LOGV)
Log.v(TAG, "init called. mNeedsInit: " + mNeedsInit);
if (mNeedsInit) {
mNeedsInit = false;
mContext = context;
// Initialize tracker
GoogleAnalytics analytics = GoogleAnalytics.getInstance(mContext);
mTracker = analytics.newTracker(R.xml.google_analytics_tracker);
}
}
use of com.google.android.gms.analytics.GoogleAnalytics in project Telecine by JakeWharton.
the class TelecineModule method provideAnalytics.
@Provides
@Singleton
Analytics provideAnalytics() {
if (BuildConfig.DEBUG) {
return new Analytics() {
@Override
public void send(Map<String, String> params) {
Timber.tag("Analytics").d(String.valueOf(params));
}
};
}
GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(app);
Tracker tracker = googleAnalytics.newTracker(BuildConfig.ANALYTICS_KEY);
// ms? s? better be s.
tracker.setSessionTimeout(300);
return new Analytics.GoogleAnalytics(tracker);
}
use of com.google.android.gms.analytics.GoogleAnalytics in project collect by opendatakit.
the class Collect method getDefaultTracker.
/**
* Gets the default {@link Tracker} for this {@link Application}.
*
* @return tracker
*/
public synchronized Tracker getDefaultTracker() {
if (tracker == null) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
tracker = analytics.newTracker(R.xml.global_tracker);
}
return tracker;
}
use of com.google.android.gms.analytics.GoogleAnalytics in project iosched by google.
the class AnalyticsHelper method autoToggleAnalytics.
/**
* Checks application state and settings_prefs, then explicitly either enables or
* disables the tracker.
*/
private static void autoToggleAnalytics() {
GoogleAnalytics instance = GoogleAnalytics.getInstance(sAppContext);
try {
// Analytics shouldn't run unless all the following are true:
// 1) A tracker has been initialized in this class (as opposed to elsewhere in the app).
// 2) The user has accepted TOS.
// 3) "Anonymous usage data" is enabled in settings.
boolean enableAnalytics = // Has Analytics been initialized?
isInitialized() && // Analytics enabled in settings.
SettingsUtils.isAnalyticsEnabled(sAppContext);
if (instance != null) {
instance.setAppOptOut(!enableAnalytics);
}
if (mFirebaseAnalytics != null) {
mFirebaseAnalytics.setAnalyticsCollectionEnabled(enableAnalytics);
}
LOGD(TAG, "Analytics" + (isInitialized() ? "" : " not") + " initialized" + ", TOS" + (WelcomeUtils.isTosAccepted(sAppContext) ? "" : " not") + " accepted" + ", Setting is" + (SettingsUtils.isAnalyticsEnabled(sAppContext) ? "" : " not") + " checked");
} catch (Exception e) {
if (instance != null) {
instance.setAppOptOut(true);
}
if (mFirebaseAnalytics != null) {
mFirebaseAnalytics.setAnalyticsCollectionEnabled(false);
}
}
}
use of com.google.android.gms.analytics.GoogleAnalytics in project vialer-android by VoIPGRID.
the class AnalyticsApplication method getDefaultTracker.
/**
* Gets the default {@link Tracker} for this {@link Application}.
* @return tracker
*/
public synchronized Tracker getDefaultTracker() {
if (mTracker == null) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
// To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG
mTracker = analytics.newTracker(R.xml.tracker);
}
JsonStorage storage = new JsonStorage(this);
SystemUser systemuser = (SystemUser) storage.get(SystemUser.class);
// Set client id as custom dimension on index 1.
if (systemuser != null) {
String clientId = systemuser.getClient();
if (clientId != null) {
mTracker.set("&cd1", clientId);
}
}
return mTracker;
}
Aggregations