com.google.analytics.tracking.android.MapBuilder Java Examples
The following examples show how to use
com.google.analytics.tracking.android.MapBuilder.
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 |
@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: RecipeItemListFragment.java From android-recipes-app with Apache License 2.0 | 6 votes |
@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 |
@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: MainMenu.java From Coloring-book with Apache License 2.0 | 6 votes |
@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 #5
Source File: MainMenu.java From Coloring-book with Apache License 2.0 | 6 votes |
@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 #6
Source File: RecipeItemDetailFragment.java From android-recipes-app with Apache License 2.0 | 5 votes |
@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 #7
Source File: RecipeItemDetailFragment.java From android-recipes-app with Apache License 2.0 | 5 votes |
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 #8
Source File: NotificationService.java From android-recipes-app with Apache License 2.0 | 5 votes |
@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 #9
Source File: NotificationService.java From android-recipes-app with Apache License 2.0 | 5 votes |
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 #10
Source File: HelloActivity.java From catnut with MIT License | 5 votes |
@Override protected void onStart() { super.onStart(); if (mTracker != null) { mTracker.send(MapBuilder.createAppView().set(Fields.SCREEN_NAME, "auth").build()); mTracker.activityStart(this); } }
Example #11
Source File: TrackedFragment.java From flow-android with MIT License | 5 votes |
@Override public void onResume() { super.onResume(); String fragmentName = ((Object) this).getClass().getSimpleName(); // Send data to Google Analytics mTracker.set(Fields.SCREEN_NAME, fragmentName); mTracker.send(MapBuilder.createAppView().build()); // Send data to Mixpanel ((FlowApplication) getActivity().getApplication()).track("Impression: " + fragmentName); }
Example #12
Source File: DrawerActivity.java From Coloring-book with Apache License 2.0 | 5 votes |
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 #13
Source File: MainMenu.java From Coloring-book with Apache License 2.0 | 5 votes |
@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; } }