Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.