本文整理匯總了Java中com.google.android.gms.analytics.Logger類的典型用法代碼示例。如果您正苦於以下問題:Java Logger類的具體用法?Java Logger怎麽用?Java Logger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Logger類屬於com.google.android.gms.analytics包,在下文中一共展示了Logger類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initGATracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public static void initGATracker(DroidPlannerApp app) {
if (sAppTracker == null) {
final Context context = app.getApplicationContext();
final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
// Call is needed for now to allow dispatching of auto activity reports
// (http://stackoverflow.com/a/23256722/1088814)
analytics.enableAutoActivityReports(app);
analytics.setAppOptOut(!DroidPlannerPrefs.getInstance(context).isUsageStatisticsEnabled());
// If we're in debug mode, set log level to verbose.
if (BuildConfig.DEBUG) {
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
}
sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker);
}
}
示例2: initGATracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public static void initGATracker(DroidPlannerApp app) {
if (sAppTracker == null) {
final Context context = app.getApplicationContext();
final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
// Call is needed for now to allow dispatching of auto activity
// reports
// (http://stackoverflow.com/a/23256722/1088814)
analytics.enableAutoActivityReports(app);
analytics.setAppOptOut(!new DroidPlannerPrefs(context).isUsageStatisticsEnabled());
// If we're in debug mode, set log level to verbose.
if (BuildConfig.DEBUG) {
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
}
sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker);
}
}
示例3: initGATracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public static void initGATracker(DroidPlannerApp app) {
if (sAppTracker == null) {
final Context context = app.getApplicationContext();
final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
// Call is needed for now to allow dispatching of auto activity reports
// (http://stackoverflow.com/a/23256722/1088814)
analytics.enableAutoActivityReports(app);
analytics.setAppOptOut(!new DroidPlannerPrefs(context).isUsageStatisticsEnabled());
// If we're in debug mode, set log level to verbose.
if (BuildConfig.DEBUG) {
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
}
sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker);
}
}
示例4: initGATracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public static void initGATracker(DroidPlannerApp app) {
if (sAppTracker == null) {
final Context context = app.getApplicationContext();
final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
// Call is needed for now to allow dispatching of auto activity reports
// (http://stackoverflow.com/a/23256722/1088814)
analytics.enableAutoActivityReports(app);
analytics.setAppOptOut(!new DroidPlannerPrefs(context).isUsageStatisticsEnabled());
// If we're in debug mode, set log level to verbose.
if (BuildConfig.DEBUG) {
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
}
sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker);
}
}
示例5: getTracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public synchronized Tracker getTracker(TrackerName trackerId) {
if (!mTrackers.containsKey(trackerId)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
/*Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID)
: (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(
R.xml.global_tracker)
: analytics.newTracker(Constants.GOOGLE_ANALYTICS_TRACKING_ID);*/
Tracker t = analytics.newTracker(Constants.GOOGLE_ANALYTICS_TRACKING_ID);
t.enableAdvertisingIdCollection(true);
mTrackers.put(trackerId, t);
}
return mTrackers.get(trackerId);
}
示例6: getTracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
synchronized Tracker getTracker(TrackerName trackerId) {
if (!mTrackers.containsKey(trackerId)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
analytics.setDryRun(false);
analytics.getLogger().setLogLevel(Logger.LogLevel.INFO);
analytics.setLocalDispatchPeriod(30);
Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(R.xml.app_tracker)
: null;
if (t != null) {
t.enableAdvertisingIdCollection(false);
}
mTrackers.put(trackerId, t);
}
return mTrackers.get(trackerId);
}
示例7: getTracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public synchronized Tracker getTracker(TrackerName trackerId) {
if (mTrackers.containsKey(trackerId)) {
return mTrackers.get(trackerId);
}
final GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
final Tracker tracker;
switch (trackerId) {
case APP_TRACKER:
tracker = analytics.newTracker(PROPERTY_ID);
break;
case GLOBAL_TRACKER:
tracker = analytics.newTracker(R.xml.global_tracker);
break;
default:
tracker = analytics.newTracker(R.xml.global_tracker);
break;
}
tracker.enableAdvertisingIdCollection(true);
mTrackers.put(trackerId, tracker);
return tracker;
}
示例8: initTracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
/**
* Initialize the tracker
*/
private void initTracker() {
final Context context = BarterLiApplication.getStaticContext();
if (!BuildConfig.REPORT_GOOGLE_ANALYTICS) {
GoogleAnalytics.getInstance(context).setDryRun(true);
GoogleAnalytics.getInstance(context).getLogger()
.setLogLevel(Logger.LogLevel.VERBOSE);
} else {
GoogleAnalytics.getInstance(context).setDryRun(false);
GoogleAnalytics.getInstance(context).getLogger()
.setLogLevel(Logger.LogLevel.ERROR);
}
mApplicationTracker = GoogleAnalytics.getInstance(context)
.newTracker(context.getString(R.string.ga_tracking_id));
//We will track manually since we use Fragments
mApplicationTracker.enableAutoActivityTracking(false);
mApplicationTracker.setSessionTimeout(SESSION_TIMEOUT);
}
示例9: initGATracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public static void initGATracker(DroidPlannerServicesApp app) {
if (sAppTracker == null) {
final Context context = app.getApplicationContext();
final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
// Call is needed for now to allow dispatching of auto activity
// reports
// (http://stackoverflow.com/a/23256722/1088814)
analytics.enableAutoActivityReports(app);
analytics.setAppOptOut(!new DroidPlannerPrefs(context).isUsageStatisticsEnabled());
// If we're in debug mode, set log level to verbose.
if (BuildConfig.DEBUG) {
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
}
sAppTracker = analytics.newTracker(R.xml.google_analytics_tracker);
}
}
示例10: initializeGATracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public void initializeGATracker() {
// Set dryRun flag.
GoogleAnalytics.getInstance(context).setDryRun(GA_IS_DRY_RUN);
// Set the log level to verbose if dryRun.
// DEFAULT is set to DRY RUN (only logging will happen)
GoogleAnalytics.getInstance(context).getLogger()
.setLogLevel(GA_IS_DRY_RUN ? Logger.LogLevel.VERBOSE : Logger.LogLevel.WARNING);
// Set the opt out flag when user updates a tracking preference.
/*
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
sp.registerOnSharedPreferenceChangeListener(
new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences pref, String key) {
if (key.equals(TRACKING_PREF_KEY)) {
GoogleAnalytics.getInstance(getApplicationContext()).setAppOptOut(
pref.getBoolean(key, false));
}
}
});
*/
}
示例11: init
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public void init(final Context context){
if (tracker==null) {
if (context==null){
throw new IllegalArgumentException("No context set.");
}
// Create new tracker
final GoogleAnalytics analytics = GoogleAnalytics.getInstance(context);
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
tracker = analytics.newTracker(R.xml.analytics);
}
}
示例12: getTracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
public synchronized Tracker getTracker(TrackerName trackerId) {
if (!mTrackers.containsKey(trackerId)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(PROPERTY_ID)
: (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(
R.xml.global_tracker)
: analytics.newTracker(R.xml.ecommerce_tracker);
t.enableAdvertisingIdCollection(true);
mTrackers.put(trackerId, t);
}
return mTrackers.get(trackerId);
}
示例13: getDefaultTracker
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
/**
* Get the default {@link Tracker} for this {@link Application}.
*
* @return tracker
*/
public static synchronized Tracker getDefaultTracker(Context context) {
if (mTracker == null) {
GoogleAnalytics analytics = GoogleAnalytics
.getInstance(context.getApplicationContext());
analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
mTracker = analytics.newTracker(R.xml.global_tracker);
}
return mTracker;
}
示例14: setupAnalyticsTools
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
private void setupAnalyticsTools() {
boolean isProd = !BuildConfig.DEBUG && BuildConfig.FLAVOR.equals("prod");
// setup fabric
Crashlytics crashlytics = new Crashlytics.Builder().disabled(!isProd).build();
final Fabric fabric = new Fabric.Builder(this)
.kits(crashlytics)
.build();
Fabric.with(fabric);
// set up timber
Timber.plant(isProd ? new CrashlyticsTree() : new Timber.DebugTree());
// set up analytics
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
SharedPreferences userPrefs = PreferenceManager.getDefaultSharedPreferences(this);
analytics.setAppOptOut(!userPrefs.getBoolean(getString(R.string.key_analytics), true));
analytics.getLogger().setLogLevel(Logger.LogLevel.ERROR);
analytics.setDryRun(!isProd);
userPrefs.registerOnSharedPreferenceChangeListener(new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(getString(R.string.key_analytics))) {
GoogleAnalytics.getInstance(getApplicationContext()).setAppOptOut(!sharedPreferences.getBoolean(key, true));
}
}
});
}
示例15: AnalyticsTrackers
import com.google.android.gms.analytics.Logger; //導入依賴的package包/類
/**
* Don't instantiate directly - use {@link #getInstance()} instead.
*/
private AnalyticsTrackers(Context context) {
Context mContext = context.getApplicationContext();
GoogleAnalytics.getInstance(mContext).setDryRun(mContext.getResources().getBoolean(R.bool.ga_dryRun));
GoogleAnalytics.getInstance(mContext).getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
mTracker = GoogleAnalytics.getInstance(mContext).newTracker(mContext.getString(R.string.ga_trackingId));
mTracker.setSessionTimeout(300);
mTracker.setAppVersion(BuildConfig.VERSION_NAME);
mTracker.setAppId(BuildConfig.APPLICATION_ID);
}