API Reference
Log In

MOCA SDK tracks automatically fragments/views of your App: this is great for tracking the screens viewed, where users dropped and how long they remained on each screen. In order to make the marketer's life easy we also offer a way to manually add a pretty name to each screen. You'll find an example below:

/**
     * Sets the name of the current Activity. This information is used for "Screen Analytics"
     * within MOCA.
     *
     * @param activity   the activity usage to be tracked
     * @param screenName activity name
     */
    public static void currentScreen(@NonNull Activity activity, @NonNull String screenName)

Example, from an activity:

MOCA.currentScreen(this, "ticket_view");

🚧

Check the name

Ensure screen names are normalized between iOS and Android. Otherwise creating campaigns using these events won't be consistent between platforms.

If your applications uses fragments, call the currentScreen on each fragment change. E.g:

private void replaceFragment(final Fragment fragment, final String title) {
        final FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.frame, fragment);
        fragmentTransaction.commit();
        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            getSupportActionBar().setTitle(title);
        }
      //--------------------------------
        MOCA.currentScreen(this, title);
      //--------------------------------
    }