com.google.analytics.tracking.android.GoogleAnalytics Java Examples

The following examples show how to use com.google.analytics.tracking.android.GoogleAnalytics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TVPortalApplication.java    From android with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    ACRA.init(this);
    SharedPreferences mPrefs;
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mPrefs.edit().putInt(ARG_LAUNCH_COUNT, (mPrefs.getInt(ARG_LAUNCH_COUNT, 0)) + 1).apply();
    //google analytics minimal just amount of install's and sessions
    mTracker = GoogleAnalytics.getInstance(this).getTracker(Config.GA_PROPERTY_ID);
    mTracker.send(MapBuilder.createEvent("UX", "appstart", null, null)
                    .set(Fields.SESSION_CONTROL, "start")
                    .build()
    );
    //Check if the user upgraded via the server:
    new AsyncTask<Void, Void, Void>() {
        @Override
        protected Void doInBackground(Void... voids) {
            AppUtils.isServerUpgraded(TVPortalApplication.this);
            return null;
        }
    }.execute();

}
 
Example #2
Source File: MainMenu.java    From Coloring-book with Apache License 2.0 6 votes vote down vote up
@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");
}
 
Example #3
Source File: MainMenu.java    From Coloring-book with Apache License 2.0 6 votes vote down vote up
@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();
            }
        }
    }
}
 
Example #4
Source File: DrawerActivity.java    From Coloring-book with Apache License 2.0 5 votes vote down vote up
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());

}
 
Example #5
Source File: MainMenu.java    From Coloring-book with Apache License 2.0 5 votes vote down vote up
@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;
    }
}
 
Example #6
Source File: MeatspaceApplication.java    From meatspace-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    preferencesHelper = new PreferencesHelper(this);

    // disable google analytics if in debug mode
    GoogleAnalytics.getInstance(this).setDryRun(BuildConfig.DEBUG);

    checkUpdate();
}
 
Example #7
Source File: BroadsheetApplication.java    From Broadsheet.ie-Android with MIT License 4 votes vote down vote up
@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;
}