当前位置: 首页>>代码示例>>Java>>正文


Java GoogleAnalytics类代码示例

本文整理汇总了Java中com.google.analytics.tracking.android.GoogleAnalytics的典型用法代码示例。如果您正苦于以下问题:Java GoogleAnalytics类的具体用法?Java GoogleAnalytics怎么用?Java GoogleAnalytics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GoogleAnalytics类属于com.google.analytics.tracking.android包,在下文中一共展示了GoogleAnalytics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTracker

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
private static Tracker getTracker(){
    if(sTracker==null){
        sTracker = GoogleAnalytics.getInstance(sInstance).getTracker(BuildConfig.GoogleAnalytics_KEY);

        ExceptionReporter handler = new ExceptionReporter(
                sTracker,                                        // Currently used Tracker.
                GAServiceManager.getInstance(),                   // GAServiceManager singleton.
                Thread.getDefaultUncaughtExceptionHandler(),
                sInstance);     // Current default uncaught exception handler.

        // Make handler the new default uncaught exception handler for main(GUI) thread.
        Thread.setDefaultUncaughtExceptionHandler(handler);

    }
    return sTracker;
}
 
开发者ID:progress-engine,项目名称:metrika_android,代码行数:17,代码来源:YandexMetrikaApplication.java

示例2: trackView

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
private void trackView(String screenname, CallbackContext callbackContext) {
if (! trackerStarted ) {
           callbackContext.error("Tracker not started");
    return;
}

       Tracker tracker = GoogleAnalytics.getInstance(this.cordova.getActivity()).getDefaultTracker();
       addCustomDimensionsToTracker(tracker);
       
       if (null != screenname && screenname.length() > 0) {
           tracker.set(Fields.SCREEN_NAME, screenname);
           tracker.send(MapBuilder
             .createAppView()
             .build()
           );
           callbackContext.success("Track Screen: " + screenname);
       } else {
           callbackContext.error("Expected one non-empty string argument.");
       }
   }
 
开发者ID:psydrake,项目名称:pandacoinBalance,代码行数:21,代码来源:UniversalAnalyticsPlugin.java

示例3: trackEvent

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
private void trackEvent(String category, String action, String label, long value, CallbackContext callbackContext) {
if (! trackerStarted ) {
    callbackContext.error("Tracker not started");
    return;
}


       Tracker tracker = GoogleAnalytics.getInstance(this.cordova.getActivity()).getDefaultTracker();
       addCustomDimensionsToTracker(tracker);

       if (null != category && category.length() > 0) {
           tracker.send(MapBuilder
               .createEvent(category, action, label, value)
               .build()
           );
           callbackContext.success("Track Event: " + category);
       } else {
           callbackContext.error("Expected non-empty string arguments.");
       }
   }
 
开发者ID:psydrake,项目名称:pandacoinBalance,代码行数:21,代码来源:UniversalAnalyticsPlugin.java

示例4: onCreate

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_menu);

    Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    serviceIntent.setPackage("com.android.vending");
    bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);

    findViewById(R.id.pack1_button).setOnClickListener(this);
    findViewById(R.id.pack2_button).setOnClickListener(this);

    Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
    tracker.send(MapBuilder.createAppView().set(Fields.SCREEN_NAME, "Home Screen").build());

    BugSenseHandler.initAndStartSession(MainMenu.this, "718d6664");
}
 
开发者ID:AlexZaiats,项目名称:Coloring-book,代码行数:18,代码来源:MainMenu.java

示例5: onActivityResult

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 1001) {
        if (resultCode == Activity.RESULT_OK) {
            try {
                Intent intent = new Intent(this, DrawerSliderActivity.class);
                intent.putExtra("pack", "pack2");
                startActivity(intent);

                Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
                tracker.send(MapBuilder
                        .createEvent("Buy", "pack", "item_bouth", null)
                        .build());
            } catch (Exception e) {

                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:AlexZaiats,项目名称:Coloring-book,代码行数:21,代码来源:MainMenu.java

示例6: onClick

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which) {
        case DialogInterface.BUTTON_POSITIVE:
            // OKが押されたら、設定を保存
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()
                    .getApplicationContext());
            boolean isOptOut = mCheckBox.isChecked();
            sp.edit().putBoolean(Const.KEY_GA_OPTOUT, isOptOut).apply();

            GoogleAnalytics.getInstance(getActivity().getApplicationContext()).setAppOptOut(
                    isOptOut);
            break;
        default:
            break;
    }
}
 
开发者ID:75py,项目名称:XUtilities,代码行数:18,代码来源:GASettingDialogFragment.java

示例7: 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");
}
 
开发者ID:mauimauer,项目名称:cheapcast,代码行数:25,代码来源:App.java

示例8: onCreate

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main_activity);
	setActionBar();
	HttpUtils.initializeVerifiedHostnames(this);
	boolean isDebuggable = ( 0 != ( getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE ) );
	// configure Google Analytics
	GoogleAnalytics.getInstance(this).setDryRun(isDebuggable);
	GoogleAnalytics.getInstance(this).getLogger().setLogLevel(isDebuggable ? LogLevel.VERBOSE : LogLevel.WARNING);
	// setup fragment
	mFragment = new CameraGalleryFragment();
	mFragment.setRetainInstance(true);
	String tag = CameraGalleryFragment.TAG;
	getSupportFragmentManager().beginTransaction().add(
			R.id.fragmentContainer, mFragment, tag).commit();

	SharedPreferences pref = PreferenceManager
			.getDefaultSharedPreferences(this);
	mDBHelper = new CameraDBHelper(this);
	mGetLatestCamerasTask = new GetLatestCameras(this, mDBHelper,
			new MainActivityFinishListener());
	if (!pref.getBoolean(Constants.PREF_EULA_ACCEPTED, false)) {
		showEula();
	} else {
		mGetLatestCamerasTask.execute();
	}
}
 
开发者ID:emuneee,项目名称:nc-traffic-cams-open,代码行数:29,代码来源:MainActivity.java

示例9: configureAnalytics

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
/**
 * Configure analytics
 */
private void configureAnalytics() {
	SharedPreferences prefs = PreferenceManager
			.getDefaultSharedPreferences(this);
	boolean analyticsEnabled = prefs.getBoolean(
			getString(R.string.send_anonymous_statisitcs), true);
	GoogleAnalytics.getInstance(this).setAppOptOut(!analyticsEnabled);
}
 
开发者ID:emuneee,项目名称:nc-traffic-cams-open,代码行数:11,代码来源:MainActivity.java

示例10: startTracker

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void startTracker(String id, CallbackContext callbackContext) {
       if (null != id && id.length() > 0) {
           GoogleAnalytics.getInstance(this.cordova.getActivity()).getTracker(id);
           callbackContext.success("tracker started");
           trackerStarted = true;
           GAServiceManager.getInstance().setLocalDispatchPeriod(30); //deprecated but whatcha gonna do? set dispatch period to 30 sec
        // Set the log level to verbose.
         /*GoogleAnalytics.getInstance(this.cordova.getActivity()).getLogger()
               .setLogLevel(LogLevel.VERBOSE);*/
       } else {
           callbackContext.error("tracker id is not valid");
       }
   }
 
开发者ID:psydrake,项目名称:pandacoinBalance,代码行数:15,代码来源:UniversalAnalyticsPlugin.java

示例11: finish_anim

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
public void finish_anim() {
    Animation animFadein = AnimationUtils.loadAnimation(
            getApplicationContext(), R.anim.slide_finish);
    level_finished.setVisibility(View.VISIBLE);
    animFadein.setAnimationListener(finish_anim);

    level_finished.startAnimation(animFadein);

    int count = screenH / 100;

    for (int i = 0; i < count; i++) {
        int id_image = 0;
        if (i % 2 == 0)
            id_image = R.drawable.star_pink;
        else
            id_image = R.drawable.star_white;

        ParticleSystem ps = new ParticleSystem(this, 100, id_image, 800);
        ps.setScaleRange(0.7f, 1.3f);
        ps.setSpeedRange(0.2f, 0.5f);
        ps.setRotationSpeedRange(90, 180);
        ps.setFadeOut(200, new AccelerateInterpolator());
        int xStart = (int) (screenW * Math.random());
        int yStart = (int) (screenH * Math.random());
        ps.oneShot(xStart, yStart, 70);
    }


    final Animation scale = AnimationUtils.loadAnimation(
            getApplicationContext(), R.anim.scale_anim);

    homeBtn.startAnimation(scale);

    Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
    tracker.send(MapBuilder
            .createEvent("Level", packName, "finish_drawing_" + level, null)
            .build());

}
 
开发者ID:AlexZaiats,项目名称:Coloring-book,代码行数:40,代码来源:DrawerActivity.java

示例12: onClick

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
@Override
public void onClick(View v) {

    switch (v.getId()) {
        case R.id.pack1_button:
            Intent intent = new Intent(this, DrawerSliderActivity.class);
            intent.putExtra("pack", "pack1");
            startActivity(intent);
            break;
        case R.id.pack2_button:

            Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
            tracker.send(MapBuilder
                    .createEvent("Buy", "pack", "try_to_buy", null)
                    .build());

            if (deviceHasGoogleAccount())
                buyClick(v);
            else {
                tracker.send(MapBuilder
                        .createEvent("Buy", "pack", "no_account", null)
                        .build());
            }

            break;
    }
}
 
开发者ID:AlexZaiats,项目名称:Coloring-book,代码行数:28,代码来源:MainMenu.java

示例13: GaAndroidModule

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
public GaAndroidModule()
{
	super();
	TiApplication appContext = TiApplication.getInstance();
	activity = appContext.getCurrentActivity();
	
	mInstance = GoogleAnalytics.getInstance(activity);
	
}
 
开发者ID:UnRyongPark,项目名称:Titanium-Google-Analytics-for-Android-v3,代码行数:10,代码来源:GaAndroidModule.java

示例14: onCreate

import com.google.analytics.tracking.android.GoogleAnalytics; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SharedPreferences sp = PreferenceManager
            .getDefaultSharedPreferences(getApplicationContext());
    GoogleAnalytics.getInstance(getApplicationContext()).setAppOptOut(
            sp.getBoolean(Const.KEY_GA_OPTOUT, true));
}
 
开发者ID:75py,项目名称:XUtilities,代码行数:10,代码来源:PrefActivity.java

示例15: 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"}));
}
 
开发者ID:mauimauer,项目名称:cheapcast,代码行数:40,代码来源:CheapCastService.java


注:本文中的com.google.analytics.tracking.android.GoogleAnalytics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。