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

The following examples show how to use com.google.analytics.tracking.android.EasyTracker. 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: TweetActivity.java    From catnut with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if (CatnutApp.getTingtingApp().getPreferences()
			.getBoolean(getString(R.string.pref_enable_analytics), true)) {
		mTracker = EasyTracker.getInstance(this);
	}
	ActionBar bar = getActionBar();
	bar.setIcon(R.drawable.ic_title_view_tweet);
	bar.setDisplayHomeAsUpEnabled(true);

	long id = getIntent().getLongExtra(Constants.ID, 0L);
	String json = getIntent().getStringExtra(Constants.JSON);
	if (savedInstanceState == null) {
		TweetFragment fragment = id != 0L
				? TweetFragment.getFragment(id)
				: TweetFragment.getFragment(json);
		// 添加back回调
		mKeyDownListener = fragment;
		getFragmentManager().beginTransaction()
				.replace(android.R.id.content, fragment)
				.commit();
	}
}
 
Example #2
Source File: RecipeItemListFragment.java    From android-recipes-app with Apache License 2.0 6 votes vote down vote up
@Override
public void onStart() {
	super.onStart();
	final Tracker tracker = EasyTracker.getInstance(getActivity());
	tracker.set(Fields.SCREEN_NAME, "Recipes list");
	tracker.send(MapBuilder.createAppView().build());
	IntentFilter intentFilter = new IntentFilter();
	intentFilter.addAction(RecipesManager.ACTION_FINISH_LOADING_RECIPES);
	intentFilter.addAction(RecipesManager.ACTION_START_LOADING_RECIPES);

	if (RecipesApplication.isLoadingRecipes) {
		getActivity().setProgressBarIndeterminateVisibility(true);
	} else {
		getActivity().setProgressBarIndeterminateVisibility(false);
	}
	LocalBroadcastManager.getInstance(getActivity()).registerReceiver(broadcastReceiver,
			intentFilter);
}
 
Example #3
Source File: RecipeItemDetailFragment.java    From android-recipes-app with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	if (item.getItemId() == R.id.menu_favorites) {
		recipesRecord.setFavorite(!recipesRecord.getFavorite());
		getActivity().supportInvalidateOptionsMenu();
		recipesRecord.update(false);
		if (recipesRecord.getFavorite()) {
			EasyTracker.getInstance(getActivity()).send(
					MapBuilder.createEvent("recipe details", "add", "favorites", 1l).build());
		} else {
			EasyTracker.getInstance(getActivity())
					.send(MapBuilder.createEvent("recipe details", "remove", "favorites", 1l)
							.build());
		}
		return true;
	} else if (item.getItemId() == R.id.menu_share) {
		shareRecipe();
		return true;
	}
	return super.onOptionsItemSelected(item);
}
 
Example #4
Source File: ProfileActivity.java    From catnut with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	mApp = CatnutApp.getTingtingApp();
	if (savedInstanceState == null) {
		final FragmentManager fragmentManager = getFragmentManager();
		fragmentManager.addOnBackStackChangedListener(this);
		Intent intent = getIntent();
		final long uid = intent.getLongExtra(Constants.ID, 0L);
		Uri uri = intent.getData();
		String screenName =
				uri == null ? intent.getStringExtra(User.screen_name) : uri.getLastPathSegment();
		fragmentManager
				.beginTransaction()
				.replace(android.R.id.content, ProfileFragment.getFragment(uid, screenName))
				.commit();
		if (mApp.getPreferences().getBoolean(getString(R.string.pref_enable_analytics), true)) {
			mTracker = EasyTracker.getInstance(this);
		}
	}
	ActionBar bar = getActionBar();
	bar.setIcon(R.drawable.ic_title_profile_default);
	bar.setDisplayHomeAsUpEnabled(true);
}
 
Example #5
Source File: AbsPreferenceActivity.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
@Override
public void onStop() {
    super.onStop();

    if (mTrackStarted) {
        EasyTracker.getInstance(this).activityStop(this);
        mTrackStarted = false;
    }
}
 
Example #6
Source File: LoginActivity.java    From flow-android with MIT License 5 votes vote down vote up
@Override
protected void onStop() {
    super.onStop();

    // Google Analytics tracking
    EasyTracker.getInstance(this).activityStop(this);
}
 
Example #7
Source File: LoginActivity.java    From flow-android with MIT License 5 votes vote down vote up
@Override
protected void onStart() {
    super.onStart();

    // Google Analytics tracking
    EasyTracker.getInstance(this).activityStart(this);

    // Mixpanel tracking
    ((FlowApplication) getApplication()).track("Impression: LoginActivity");
}
 
Example #8
Source File: MainActivity.java    From meatspace-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onStart() {
    super.onStart();
    EasyTracker.getInstance(this).activityStart(this);
    ChatService.start(this);
    BusManager.get().getUiBus().post(UIEvent.FOREGROUD);
}
 
Example #9
Source File: ComposeTweetActivity.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.compose);
	mApp = CatnutApp.getTingtingApp();
	mActionBar = getActionBar();

	mTitle = getString(R.string.compose);
	mEmotionTitle = getString(R.string.add_emotions);

	injectLayout();
	injectActionBar();
	injectListener();

	handleOuterShare();

	mActionBar.setIcon(R.drawable.ic_title_compose);
	mActionBar.setTitle(mTitle);
	mActionBar.setDisplayHomeAsUpEnabled(true);
	mActionBar.setHomeButtonEnabled(true);

	mInputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);

	if (mApp.getPreferences().getBoolean(getString(R.string.pref_enable_analytics), true)) {
		mTracker = EasyTracker.getInstance(this);
	}
}
 
Example #10
Source File: BaseFragmentActivity.java    From Broadsheet.ie-Android with MIT License 5 votes vote down vote up
@Override
protected void onStart() {
    spiceManager.start(this);
    super.onStart();

    EasyTracker.getInstance().activityStart(this);
}
 
Example #11
Source File: NoHistoryActivity.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if (savedInstanceState == null) {
		getFragmentManager().beginTransaction()
				.replace(android.R.id.content, new OAuthFragment())
				.commit();

	}
	if (CatnutApp.getBoolean(R.string.pref_enable_analytics, R.bool.pref_true)) {
		mTracker = EasyTracker.getInstance(this);
	}
}
 
Example #12
Source File: PluginsActivity.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	ActionBar bar = getActionBar();
	bar.setTitle(R.string.plugins);
	getFragmentManager().addOnBackStackChangedListener(this);
	int which = getIntent().getIntExtra(Constants.ACTION, -1);
	switch (which) {
		case ACTION_ZHIHU_ITEM:
		case ACTION_ZHIHU_PAGER:
			if (savedInstanceState == null) {
				Fragment fragment =
						which == ACTION_ZHIHU_ITEM
						? ZhihuItemFragment.getFragment(getIntent().getLongExtra(Constants.ID, 0L))
						: PagerItemFragment.getFragment(getIntent().getLongExtra(Constants.ID, 0L),
								getIntent().getLongExtra(PagerItemFragment.ORDER_ID, 0L));
				getFragmentManager().beginTransaction()
						.replace(android.R.id.content, fragment)
						.commit();
			}
			break;
		default:
			injectPager(bar, savedInstanceState);
			break;
	}
	if (CatnutApp.getTingtingApp().getPreferences().getBoolean(getString(R.string.pref_enable_analytics), true)) {
		mTracker = EasyTracker.getInstance(this);
	}
}
 
Example #13
Source File: BaseFragmentActivity.java    From Broadsheet.ie-Android with MIT License 5 votes vote down vote up
@Override
protected void onStop() {
    spiceManager.shouldStop();
    super.onStop();

    EasyTracker.getInstance().activityStop(this);
}
 
Example #14
Source File: SynthCircle.java    From Circle-Synth with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// Setting up Google analytics. GA parameters in the analytics.xml file
	EasyTracker.getInstance().setContext(getApplicationContext());
	// Instantiate the Tracker
	tracker = EasyTracker.getTracker();

	/**
	 * IMPORTANT : if using decimal format, remember to set the decimal
	 * separator explicitly, else your app will crash when used in locales
	 * which use ',' as the decimal separator.
	 */
	symbols.setDecimalSeparator('.');
	df = new DecimalFormat("#.##", symbols);
	df1 = new DecimalFormat("#.#", symbols);

	// Accessing default Shared Preferences
	prefs = PreferenceManager.getDefaultSharedPreferences(this);

	// Call and setup the accelerometer which we will be using later
	mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
	mAccelerometer = mSensorManager
			.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
	mSensorManager.registerListener(this, mAccelerometer, 100000);

	// make sure the screen doesn't turn off
	getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

	initPdService();

	/*
	 * IMPORTANT:make sure you have the READ_PHONE_STATE permission
	 * specified to use the method below. This method will ensure that
	 * pdservice is paused during a phone call.
	 */
	initSystemServices();

}
 
Example #15
Source File: NotificationService.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
private void displayNotification() {
	Log.d(TAG, "displayNotification");

	RecipesRecord record = SQuery.newQuery().selectFirst(Recipes.CONTENT_URI, "random()");

	Bitmap image = ImageLoader.getInstance().loadImageSync(record.getImage());

	Log.d(TAG, String.format("chosen %s for notification", record.getId()));

	Intent intent = RecipeItemListActivity.newIntentForRecipe(this, record.getId())
			.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
	NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
			.setAutoCancel(true)
			.setSmallIcon(R.drawable.ic_launcher)
			.setPriority(NotificationCompat.PRIORITY_LOW)
			.setLargeIcon(image)
			.setDeleteIntent(
					PendingIntent.getService(this, 0, getIntentForDelete(this),
							PendingIntent.FLAG_UPDATE_CURRENT))
			.setContentIntent(
					PendingIntent.getActivity(this, 0, intent,
							PendingIntent.FLAG_UPDATE_CURRENT))
			.setContentTitle(record.getName());

	NotificationCompat.BigPictureStyle bigStyle = new NotificationCompat.BigPictureStyle()
			.bigLargeIcon(
					((BitmapDrawable) getResources().getDrawable(R.drawable.ic_launcher))
							.getBitmap()).bigPicture(image);

	// Moves the big view style object into the notification object.
	builder.setStyle(bigStyle);

	// mId allows you to update the notification later on.
	Log.d(TAG, "displaying notification");
	notificationManager.notify(1, builder.build());

	EasyTracker.getInstance(this).send(
			MapBuilder.createEvent("notification", "display", "recipe notification", 1l)
					.build());
}
 
Example #16
Source File: NotificationService.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
@Override
protected void onHandleIntent(Intent intent) {
	Log.d(TAG, String.format("onHandleIntent: %s", intent));
	if (ACTION_REGISTER_ALARM.equals(intent.getAction())) {
		registerAlarm();
	} else if (ACTION_DISPLAY_NOTIFICATION.equals(intent.getAction())) {
		displayNotification();
	} else if (ACTION_NOTIFICATION_DELETE.equals(intent.getAction())) {
		registerAlarm();
		EasyTracker.getInstance(this).send(
				MapBuilder.createEvent("notification", "dismiss", "recipe notification", 1l)
						.build());
	}
}
 
Example #17
Source File: RecipeItemDetailFragment.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
private void shareRecipe() {
	Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
	sharingIntent.setType("text/plain");
	sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, recipesRecord.getName());
	sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, generateShareText());
	getActivity().startActivity(
			Intent.createChooser(sharingIntent, getActivity().getString(R.string.share_via)));
	EasyTracker.getInstance(getActivity()).send(
			MapBuilder.createEvent("recipe details", "share", "share", 1l).build());
}
 
Example #18
Source File: RecipeItemDetailFragment.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
@Override
public void onStart() {
	super.onStart();
	final Tracker tracker = EasyTracker.getInstance(getActivity());
	tracker.set(Fields.SCREEN_NAME, "Recipe Details");
	tracker.send(MapBuilder.createAppView().build());
}
 
Example #19
Source File: AbsPreferenceActivity.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
@Override
public void onStart() {
    super.onStart();

    if (Settings.getAnalysis()) {
        EasyTracker.getInstance(this).activityStart(this);
        mTrackStarted = true;
    }
}
 
Example #20
Source File: AbsActivity.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
@Override
public void onStop() {
    super.onStop();

    if (mTrackStarted) {
        EasyTracker.getInstance(this).activityStop(this);
        mTrackStarted = false;
    }
}
 
Example #21
Source File: AbsActivity.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
@Override
public void onStart() {
    super.onStart();

    if (Settings.getAnalysis()) {
        EasyTracker.getInstance(this).activityStart(this);
        mTrackStarted = true;
    }
}
 
Example #22
Source File: SynthCircle.java    From Circle-Synth with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onStart() {
	super.onStart();
	// this gives analytics the cue to start tracking
	EasyTracker.getInstance().activityStart(this); // Add this method
}
 
Example #23
Source File: MainActivity.java    From meatspace-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void onStop() {
    super.onStop();
    EasyTracker.getInstance(this).activityStop(this);
    BusManager.get().getUiBus().post(UIEvent.BACKGROUND);
}
 
Example #24
Source File: SynthCircle.java    From Circle-Synth with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onStop() {
	super.onStop();
	// stop GA tracking
	EasyTracker.getInstance().activityStop(this); // Add this method
}
 
Example #25
Source File: StoryListActivity.java    From scanvine-android with MIT License 4 votes vote down vote up
@Override
protected void onStop() {
	EasyTracker.getInstance(this).activityStop(this);
	super.onStop();
}
 
Example #26
Source File: StoryListActivity.java    From scanvine-android with MIT License 4 votes vote down vote up
@Override
protected void onStart() {
	super.onStart();
	EasyTracker.getInstance(this).activityStart(this);
}
 
Example #27
Source File: SourceListActivity.java    From scanvine-android with MIT License 4 votes vote down vote up
@Override
protected void onStop() {
	EasyTracker.getInstance(this).activityStop(this);
	super.onStop();
}
 
Example #28
Source File: SourceListActivity.java    From scanvine-android with MIT License 4 votes vote down vote up
@Override
protected void onStart() {
	super.onStart();
	EasyTracker.getInstance(this).activityStart(this);
}
 
Example #29
Source File: SplashActivity.java    From scanvine-android with MIT License 4 votes vote down vote up
@Override
protected void onStop() {
	EasyTracker.getInstance(this).activityStop(this);
	super.onStop();
}
 
Example #30
Source File: SplashActivity.java    From scanvine-android with MIT License 4 votes vote down vote up
@Override
protected void onStart() {
	super.onStart();
	EasyTracker.getInstance(this).activityStart(this);
}