Skip to content

Instantly share code, notes, and snippets.

@dimmduh
Created September 29, 2017 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimmduh/9ab5bfef5cf23ae266555d1f3c1046c7 to your computer and use it in GitHub Desktop.
Save dimmduh/9ab5bfef5cf23ae266555d1f3c1046c7 to your computer and use it in GitHub Desktop.
App2top event tracking MainActivity example
package org.app2top.tracking.example;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import org.app2top.tracking.App2top;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
App2top.debug = true;
findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
App2top.sendEvent(getApplicationContext(), "Launch");
Snackbar.make(view, "Event sent - Launch", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
App2top.sendEvent(getApplicationContext(), "Level45");
Snackbar.make(view, "Event sent - Level45", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
findViewById(R.id.button3).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
App2top.sendEvent(getApplicationContext(), "HeroReachedLevel5");
Snackbar.make(view, "Event sent - HeroReachedLevel5", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment