本文整理汇总了Java中com.google.analytics.tracking.android.GoogleAnalytics.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleAnalytics.getInstance方法的具体用法?Java GoogleAnalytics.getInstance怎么用?Java GoogleAnalytics.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.analytics.tracking.android.GoogleAnalytics
的用法示例。
在下文中一共展示了GoogleAnalytics.getInstance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mGoogleAnalytics = GoogleAnalytics.getInstance(this);
mGaTracker = mGoogleAnalytics.getTracker(getString(R.string.ga_trackingId));
mGoogleAnalytics.setAppOptOut(mPreferences.getBoolean("analytics", false));
Thread.UncaughtExceptionHandler myHandler = new ExceptionReporter(
mGaTracker, // Currently used Tracker.
GAServiceManager.getInstance(), // GAServiceManager singleton.
Thread.getDefaultUncaughtExceptionHandler(), this); // Current default uncaught exception handler.
// Make myHandler the new default uncaught exception handler.
Thread.setDefaultUncaughtExceptionHandler(myHandler);
// work-around for Android defect 9431
System.setProperty("java.net.preferIPv4Stack", "true");
System.setProperty("java.net.preferIPv6Addresses", "false");
System.setProperty("org.eclipse.jetty.util.UrlEncoded.charset", "utf-8");
}
示例2: GaAndroidModule
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
public GaAndroidModule()
{
super();
TiApplication appContext = TiApplication.getInstance();
activity = appContext.getCurrentActivity();
mInstance = GoogleAnalytics.getInstance(activity);
}
示例3: onCreate
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Log.d(LOG_TAG, "onCreate()");
mWifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
mNetIf = Utils.getActiveNetworkInterface();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mPreferences = getSharedPreferences("cheapcast", MODE_PRIVATE | MODE_MULTI_PROCESS);
} else {
mPreferences = getSharedPreferences("cheapcast", MODE_PRIVATE);
}
Log.d(LOG_TAG, String.format("Starting up: friendlyName: %s", mPreferences.getString("friendly_name","CheapCasto")));
mGson = new Gson();
mGoogleAnalytics = GoogleAnalytics.getInstance(this);
mGaTracker = mGoogleAnalytics.getTracker(getString(R.string.ga_trackingId));
mGoogleAnalytics.setAppOptOut(mPreferences.getBoolean("analytics", false));
Thread.UncaughtExceptionHandler myHandler = new ExceptionReporter(
mGaTracker, // Currently used Tracker.
GAServiceManager.getInstance(), // GAServiceManager singleton.
Thread.getDefaultUncaughtExceptionHandler(), this); // Current default uncaught exception handler.
mGaTracker.sendEvent("CheapCastService","ServiceStart", null,null);
mRegisteredApps = new HashMap<String, App>();
registerApp(new App("ChromeCast", "https://www.gstatic.com/cv/receiver.html?$query"));
registerApp(new App("YouTube", "https://www.youtube.com/tv?$query"));
registerApp(new App("PlayMovies", "https://play.google.com/video/avi/eureka?$query", new String[]{"play-movies", "ramp"}));
registerApp(new App("GoogleMusic", "https://play.google.com/music/cast/player"));
registerApp(new App("GoogleCastSampleApp", "http://anzymrcvr.appspot.com/receiver/anzymrcvr.html"));
registerApp(new App("GoogleCastPlayer", "https://www.gstatic.com/eureka/html/gcp.html"));
registerApp(new App("Fling", "$query"));
registerApp(new App("TicTacToe", "http://www.gstatic.com/eureka/sample/tictactoe/tictactoe.html", new String[]{"com.google.chromecast.demo.tictactoe"}));
}
示例4: onCreate
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.ACRA_ENABLE) {
ACRA.init(this);
EasyTracker.getInstance(this);
GoogleAnalytics.getInstance(this);
}
Log.e(TAG, "onCreate");
}
示例5: initializeGa
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
/**
* Initialize Google Analytics tracker.
*/
private void initializeGa() {
mGa = GoogleAnalytics.getInstance(this);
mTracker = mGa.getTracker(GA_PROPERTY_ID);
// Set dispatch period.
GAServiceManager.getInstance().setLocalDispatchPeriod(GA_DISPATCH_PERIOD);
// Set Logger verbosity.
mGa.getLogger().setLogLevel(GA_LOG_VERBOSITY);
}
示例6: init
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
public static void init(Context ctx, int dispatchSeconds) {
// Start the tracker in manual dispatch mode...
// tracker.startNewSession("UA-YOUR-ACCOUNT-HERE", this);
// ...alternatively, the tracker can be started with a dispatch interval
// (in seconds).
GoogleAnalytics.getInstance(ctx);
EasyTracker.getInstance(ctx);
GAServiceManager.getInstance().setLocalDispatchPeriod(dispatchSeconds);
if (me == null) {
me = new AnalyticsGoogleV3();
Analytics.add(me);
}
}
示例7: onStart
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(this);
googleAnalytics.getTracker(getResources().getString(R.string.ga_trackingId));
EasyTracker.getInstance().setContext(this);
EasyTracker.getInstance().activityStart(this);
}
示例8: Analytics
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
public Analytics(Context context) {
mGaInstance = GoogleAnalytics.getInstance(context);
//testes UA-38962564-1 pra valer UA-40266822-1
mGaTracker = mGaInstance.getTracker("UA-40266822-1");
GAServiceManager.getInstance().setDispatchPeriod(30);
String deviceId = ((TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId();
if (deviceId == null)
deviceId = "anonymous";
track("/user/" + deviceId);
}
示例9: onCreate
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (Const.DEVELOPER_MODE) {
StrictMode.ThreadPolicy.Builder b = new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB){
b.penaltyFlashScreen();
}
//StrictMode.setThreadPolicy(b.build());
}
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
} else {
// TODO Crashlytics.start(this);
// TODO Timber.plant(new CrashlyticsTree());
}
// Initialize ACRA Bugreporting (reports get send to GDG[x] Hub)
ACRA.init(this);
mInstance = this;
mPreferences = getSharedPreferences("gdg", MODE_PRIVATE);
try {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
if(mPreferences.getInt(Const.SETTINGS_VERSION_CODE, 0) < pInfo.versionCode)
migrate(mPreferences.getInt(Const.SETTINGS_VERSION_CODE, 0), pInfo.versionCode);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
// Initialize ModelCache and Volley
getModelCache();
getBitmapCache();
GdgVolley.init(this);
mPreferences.edit().putInt(Const.SETTINGS_APP_STARTS, mPreferences.getInt(Const.SETTINGS_APP_STARTS,0)+1).apply();
// Initialize Picasso
mPicasso = new Picasso.Builder(this)
.downloader(new OkHttpDownloader(this))
.memoryCache(new LruCache(this))
.build();
mPicasso.setDebugging(Const.DEVELOPER_MODE);
// Initialize GA
mGaInstance = GoogleAnalytics.getInstance(getApplicationContext());
mTracker = mGaInstance.getTracker(getString(R.string.ga_trackingId));
GAServiceManager.getInstance().setDispatchPeriod(0);
mTracker.setAppName(getString(R.string.app_name));
mTracker.setAnonymizeIp(true);
mGaInstance.setDefaultTracker(mTracker);
mOrganizerChecker = new OrganizerChecker(this, mPreferences);
mOrganizerChecker.setLastOrganizerCheckTime(mPreferences.getLong("organizer_check_time", 0));
mOrganizerChecker.setLastOrganizerCheckId(mPreferences.getString("organizer_check_id", null));
GoogleAnalytics.getInstance(this).setAppOptOut(mPreferences.getBoolean("analytics",false));
// Init LastLocationFinder
mLocationFinder = new GingerbreadLastLocationFinder(this);
mLocationFinder.setChangedLocationListener(this);
updateLastLocation();
}
示例10: initializeGa
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
private void initializeGa() {
mGa = GoogleAnalytics.getInstance(this);
mTracker = mGa.getTracker("UA-45502770-1");
}
示例11: onCreate
import com.google.analytics.tracking.android.GoogleAnalytics; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// Create global configuration and initialize ImageLoader with this configuration
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).build();
ImageLoader.getInstance().init(config);
this.posts = new ArrayList<Post>();
Crashlytics.start(this);
mGaInstance = GoogleAnalytics.getInstance(this);
mGaTracker = mGaInstance.getTracker("UA-5653857-3");
mApp = this;
}