Java Code Examples for com.google.android.gms.analytics.Tracker#setScreenName()

The following examples show how to use com.google.android.gms.analytics.Tracker#setScreenName() . 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: ConfigurationActivity.java    From Noyze with Apache License 2.0 6 votes vote down vote up
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setupActionBar(this);
    MainThreadBus.get().register(this);
    ChangeLogDialog.show(this, true);

    // TRACK: activity view.
    if (NoyzeApp.GOOGLE_ANALYTICS) {
        Tracker t = ((NoyzeApp) getApplication()).getTracker(
                NoyzeApp.TrackerName.APP_TRACKER);
        t.setScreenName(getClass().getSimpleName());
        t.send(new HitBuilders.AppViewBuilder().build());
    }
}
 
Example 2
Source File: BarometerNetworkActivity.java    From PressureNet with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onStart() {
	dataReceivedToPlot = false;
	// bindCbService();
	super.onStart();
	log("barometernetworkactivity onstart");
	// Get tracker.
	Tracker t = ((PressureNetApplication) getApplication()).getTracker(
	    TrackerName.APP_TRACKER);


	// Set screen name.
	t.setScreenName("PressureNet Main App");

	// Send a screen view.
	t.send(new HitBuilders.ScreenViewBuilder().build());
}
 
Example 3
Source File: SearchList.java    From moviedb-android with Apache License 2.0 6 votes vote down vote up
/**
 * Called to have the fragment instantiate its user interface view.
 *
 * @param inflater           sets the layout for the current view.
 * @param container          the container which holds the current view.
 * @param savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.
 *                           Return the View for the fragment's UI, or null.
 */
@SuppressLint("ShowToast")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);


    View rootView = inflater.inflate(R.layout.searchlist, container, false);
    listView = (AbsListView) rootView.findViewById(R.id.movieslist);
    listView.setOnItemClickListener(this);
    toastLoadingMore = Toast.makeText(getActivity(), R.string.loadingMore, Toast.LENGTH_SHORT);
    activity = ((MainActivity) getActivity());

    Tracker t = ((MovieDB) activity.getApplication()).getTracker();
    t.setScreenName("Search");
    t.send(new HitBuilders.ScreenViewBuilder().build());

    return rootView;
}
 
Example 4
Source File: TrailerList.java    From moviedb-android with Apache License 2.0 6 votes vote down vote up
/**
 * Called to have the fragment instantiate its user interface view.
 *
 * @param inflater           sets the layout for the current view.
 * @param container          the container which holds the current view.
 * @param savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.
 *                           Return the View for the fragment's UI, or null.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);


    View rootView;
    rootView = inflater.inflate(R.layout.gallerylist, container, false);
    listView = (AbsListView) rootView.findViewById(R.id.gridView);
    activity = ((MainActivity) getActivity());

    Tracker t = ((MovieDB) activity.getApplication()).getTracker();
    t.setScreenName("TrailerList - " + getTitle());
    t.send(new HitBuilders.ScreenViewBuilder().build());

    return rootView;
}
 
Example 5
Source File: GAlette.java    From GAlette with Apache License 2.0 6 votes vote down vote up
private void sendAppView0(Object target, Context appContext, Method method, Object[] arguments) {
    final SendAppView analyticsAnnotation = method.getAnnotation(SendAppView.class);
    final Tracker tracker = trackerFrom(appContext, analyticsAnnotation.trackerName());
    if (tracker == null) {
        return;
    }

    final HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();
    try {
        final FieldBuilder<String> screenNameBuilder = createStringFieldBuilder(analyticsAnnotation.screenNameBuilder());
        final String screenName = screenNameBuilder.build(Fields.SCREEN_NAME, analyticsAnnotation.screenName(), target, method, arguments);
        tracker.setScreenName(screenName);
        HitInterceptor hitInterceptor = hitInterceptorFrom(appContext, analyticsAnnotation.trackerName());
        hitInterceptor.onScreenView(new ScreenViewBuilderDelegate(builder));
    } finally {
        tracker.send(builder.build());
    }
}
 
Example 6
Source File: GAlette.java    From GAlette with Apache License 2.0 6 votes vote down vote up
private void sendScreenView0(Object target, Context appContext, Method method, Object[] arguments) {
    final SendScreenView analyticsAnnotation = method.getAnnotation(SendScreenView.class);
    final Tracker tracker = trackerFrom(appContext, analyticsAnnotation.trackerName());
    if (tracker == null) {
        return;
    }

    final HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder();
    try {
        final FieldBuilder<String> screenNameBuilder = createStringFieldBuilder(analyticsAnnotation.screenNameBuilder());
        final String screenName = screenNameBuilder.build(Fields.SCREEN_NAME, analyticsAnnotation.screenName(), target, method, arguments);
        tracker.setScreenName(screenName);
        HitInterceptor hitInterceptor = hitInterceptorFrom(appContext, analyticsAnnotation.trackerName());
        hitInterceptor.onScreenView(new ScreenViewBuilderDelegate(builder));
    } finally {
        tracker.send(builder.build());
    }
}
 
Example 7
Source File: MovieDetailFragment.java    From Movie-Check with Apache License 2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    Tracker defaultTracker = ((MovieCheckApplication) getActivity().getApplication()).getDefaultTracker();
    defaultTracker.setScreenName("Movie Detail Screen");
    defaultTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
 
Example 8
Source File: UserProfileActivity.java    From Movie-Check with Apache License 2.0 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    Tracker defaultTracker = ((MovieCheckApplication) getApplication()).getDefaultTracker();
    defaultTracker.setScreenName("User Profile Screen");
    defaultTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
 
Example 9
Source File: HomeActivity.java    From Movie-Check with Apache License 2.0 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    Tracker defaultTracker = ((MovieCheckApplication) getApplication()).getDefaultTracker();
    defaultTracker.setScreenName("Home Screen");
    defaultTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
 
Example 10
Source File: MediaControlActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
public void onHandleIntent(Intent intent) {
    if (null == intent) return;
    LOGD(TAG, "onHandleIntent(" + intent.toString() + ")");

    // TRACK: activity view.
    if (NoyzeApp.GOOGLE_ANALYTICS) {
        Tracker t = ((NoyzeApp) getApplication()).getTracker(
                NoyzeApp.TrackerName.APP_TRACKER);
        t.setScreenName(getClass().getSimpleName());
        t.send(new HitBuilders.AppViewBuilder().build());
    }

    Bundle extras = intent.getExtras();

    if (null == extras || !extras.containsKey(Intent.EXTRA_KEY_EVENT)) {
        Log.e(TAG, "KeyEvent null, cannot dispatch media event.");
        finish();
        return;
    }

    final int keyCode = extras.getInt(Intent.EXTRA_KEY_EVENT);
    if (!Utils.isMediaKeyCode(keyCode)) {
        Log.e(TAG, "KeyEvent was not one of KEYCODE_MEDIA_* events.");
        finish();
        return;
    }

    LOGD(TAG, "Dispatching media event: " + keyCode);
    AudioManager manager = (AudioManager) getSystemService(AUDIO_SERVICE);
    AudioHelper helper = AudioHelper.getHelper(getApplicationContext(), manager);
    helper.dispatchMediaKeyEvent(getApplicationContext(), keyCode);

    finish();
}
 
Example 11
Source File: MainActivity.java    From android with MIT License 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();

    loadStats();

    mAddress = accountManager.getAddress(this);
    mLatitude = accountManager.getLat(this);
    mLongitude = accountManager.getLng(this);

    String location = getLocationString();
    if (!TextUtils.isEmpty(location)) {
        AppSingleton.getInstance(getApplicationContext()).getJsonController()
                .getContacts(location);
    }

    // Refresh on resume.  The post is necessary to start the spinner animation.
    swipeContainer.post(new Runnable() {
        @Override public void run() {
            swipeContainer.setRefreshing(true);
            refreshIssues();
        }
    });

    // We allow Analytics opt-out.
    if (accountManager.allowAnalytics(this)) {
        // Obtain the shared Tracker instance.
        FiveCallsApplication application = (FiveCallsApplication) getApplication();
        Tracker tracker = application.getDefaultTracker();
        tracker.setScreenName(TAG);
        tracker.send(new HitBuilders.ScreenViewBuilder().build());
    }
}
 
Example 12
Source File: ListTopRatedMoviesActivity.java    From Movie-Check with Apache License 2.0 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    Tracker defaultTracker = ((MovieCheckApplication) getApplication()).getDefaultTracker();
    defaultTracker.setScreenName("List Of Top Rated Movies Screen");
    defaultTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
 
Example 13
Source File: FoldersFragment.java    From IdealMedia with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    listView = (RecyclerView) view.findViewById(android.R.id.list);
    listView.setLayoutManager(new LinearLayoutManager(getActivity()));
    listView.setItemAnimator(new DefaultItemAnimator());

    Tracker t = ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER);
    t.setScreenName("Folders and files");
    t.send(new HitBuilders.AppViewBuilder().build());
}
 
Example 14
Source File: WhatsNewActivity.java    From PressureNet with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onStart() {
	// Get tracker.
	Tracker t = ((PressureNetApplication) getApplication())
			.getTracker(TrackerName.APP_TRACKER);
	// Set screen name.
	t.setScreenName("What's New");

	// Send a screen view.
	t.send(new HitBuilders.ScreenViewBuilder().build());
	super.onStart();
}
 
Example 15
Source File: PanelShortcutActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
public void onHandleIntent(Intent intent) {
    if (null == intent) return;
    LOGD(TAG, "onHandleIntent(" + intent.toString() + ")");
    String action = intent.getAction();

    // TRACK: activity view.
    if (NoyzeApp.GOOGLE_ANALYTICS) {
        Tracker t = ((NoyzeApp) getApplication()).getTracker(
                NoyzeApp.TrackerName.APP_TRACKER);
        t.setScreenName(getClass().getSimpleName());
        t.send(new HitBuilders.AppViewBuilder().build());
    }

    // We've got one mission and one mission only!
    if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) {
        setupShortcut();
        return;
    }

    // If Noyze is active, open the panel.
    if (VolumeAccessibilityService.isEnabled(this)) {
        Intent openPanel = new Intent(getApplicationContext(), VolumeAccessibilityService.class);
        openPanel.putExtra("show", true);
        openPanel.setPackage(getPackageName());
        startService(openPanel);
    } else {
        // If it's not, bring up the app.
        Intent openApp = getPackageManager().getLaunchIntentForPackage(getPackageName());
        openApp.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
        startActivity(openApp);
    }

    finish();
}
 
Example 16
Source File: PlayerFragment.java    From IdealMedia with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    adapter = new PlayerAdapter(activity, this, items);
    listView = (RecyclerView) view.findViewById(android.R.id.list);
    listView.setLayoutManager(new LinearLayoutManager(getActivity()));
    listView.setItemAnimator(new DefaultItemAnimator());

    listView.setAdapter(adapter);

    Tracker t = ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER);
    t.setScreenName("Now playing");
    t.send(new HitBuilders.AppViewBuilder().build());
}
 
Example 17
Source File: PanelShortcutActivity.java    From Noyze with Apache License 2.0 5 votes vote down vote up
public void onHandleIntent(Intent intent) {
    if (null == intent) return;
    LOGD(TAG, "onHandleIntent(" + intent.toString() + ")");
    String action = intent.getAction();

    // TRACK: activity view.
    if (NoyzeApp.GOOGLE_ANALYTICS) {
        Tracker t = ((NoyzeApp) getApplication()).getTracker(
                NoyzeApp.TrackerName.APP_TRACKER);
        t.setScreenName(getClass().getSimpleName());
        t.send(new HitBuilders.AppViewBuilder().build());
    }

    // We've got one mission and one mission only!
    if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) {
        setupShortcut();
        return;
    }

    // If Noyze is active, open the panel.
    if (VolumeAccessibilityService.isEnabled(this)) {
        Intent openPanel = new Intent(getApplicationContext(), VolumeAccessibilityService.class);
        openPanel.putExtra("show", true);
        openPanel.setPackage(getPackageName());
        startService(openPanel);
    } else {
        // If it's not, bring up the app.
        Intent openApp = getPackageManager().getLaunchIntentForPackage(getPackageName());
        openApp.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
        startActivity(openApp);
    }

    finish();
}
 
Example 18
Source File: UserDetailFragment.java    From Movie-Check with Apache License 2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    Tracker defaultTracker = ((MovieCheckApplication) getActivity().getApplication()).getDefaultTracker();
    defaultTracker.setScreenName("User Detail Screen");
    defaultTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
 
Example 19
Source File: TVDetails.java    From moviedb-android with Apache License 2.0 4 votes vote down vote up
/**
 * @param savedInstanceState if the fragment is being re-created from a previous saved state, this is the state.
 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (save != null) {
        setTitle(save.getString("title"));
        currentId = save.getInt("currentId");
        timeOut = save.getInt("timeOut");
        if (timeOut == 0) {
            spinner.setVisibility(View.GONE);
            onOrientationChange(save);
        }
    }

    if (currentId != this.getArguments().getInt("id") || this.timeOut == 1) {
        currentId = this.getArguments().getInt("id");
        moreIcon.setVisibility(View.INVISIBLE);
        mSlidingTabLayout.setVisibility(View.INVISIBLE);
        mViewPager.setVisibility(View.INVISIBLE);
        spinner.setVisibility(View.VISIBLE);

        request = new JSONAsyncTask();
        new Thread(new Runnable() {
            public void run() {
                try {
                    request.execute(MovieDB.url + "tv/" + currentId + "?append_to_response=images,credits,similar&api_key=" + MovieDB.key).get(10000, TimeUnit.MILLISECONDS);
                } catch (TimeoutException | ExecutionException | InterruptedException | CancellationException e) {
                    request.cancel(true);
                    // we abort the http request, else it will cause problems and slow connection later
                    if (conn != null)
                        conn.disconnect();
                    if (spinner != null)
                        activity.hideView(spinner);
                    if (mViewPager != null)
                        activity.hideLayout(mViewPager);
                    if (getActivity() != null && !(e instanceof CancellationException)) {
                        getActivity().runOnUiThread(new Runnable() {
                            public void run() {
                                Toast.makeText(getActivity(), getResources().getString(R.string.timeout), Toast.LENGTH_SHORT).show();
                            }
                        });
                    }
                    setTimeOut(1);
                }
            }
        }).start();
    }
    activity.setTitle(getTitle());
    activity.setTvDetailsFragment(this);
    if (activity.getSaveInTVDetailsSimFragment()) {
        activity.setSaveInTVDetailsSimFragment(false);
        activity.setTvDetailsSimFragment(this);
    }

    new Handler().post(new Runnable() {
        @Override
        public void run() {
            tvDetailsInfo = (TVDetailsInfo) tvDetailsSlideAdapter.getRegisteredFragment(0);
            tvDetailsCast = (TVDetailsCast) tvDetailsSlideAdapter.getRegisteredFragment(1);
            tvDetailsOverview = (TVDetailsOverview) tvDetailsSlideAdapter.getRegisteredFragment(2);
        }
    });

    showInstantToolbar();

    iconMarginConstant = activity.getIconMarginConstant();
    iconMarginLandscape = activity.getIconMarginLandscape();
    iconConstantSpecialCase = activity.getIconConstantSpecialCase();
    twoIcons = activity.getTwoIcons();
    twoIconsToolbar = activity.getTwoIconsToolbar();
    oneIcon = activity.getOneIcon();
    oneIconToolbar = activity.getOneIconToolbar();

    Tracker t = ((MovieDB) activity.getApplication()).getTracker();
    t.setScreenName("TVDetails - " + getTitle());
    t.send(new HitBuilders.ScreenViewBuilder().build());
}
 
Example 20
Source File: AnalyticsUtil.java    From IndiaSatelliteWeather with GNU General Public License v2.0 3 votes vote down vote up
public void trackScreen(String screenName) {

        Tracker tracker = getTracker();

        if (tracker == null) return;

        // Set the screen name.
        tracker.setScreenName(screenName);

        // Send AppView hit.
        tracker.send(new HitBuilders.ScreenViewBuilder().build());
    }