Skip to content

Latest commit

 

History

History
73 lines (62 loc) · 1.79 KB

README.md

File metadata and controls

73 lines (62 loc) · 1.79 KB

Touch-Events-Tracker



Touch Events Tracker is an Android SDK which tracks touch actions in application.Following are touch actions which it can track:

  • Touch on any view
  • Swipe/Fling
  • Single Tap/Double Tap
  • Scroll

Gradle Integration

Add below line in dependency block of app's gradle file:

dependencies {
    compile 'com.krishna.event_tracker:eventtrackersdk:1.0@aar'
}

Initialisation

Add below line in onCreate method of custom Application class

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        new EventDetector(this); //where this is Application context
    }
}
Or in app's startup activity**

public class MainActivity extends AppCompatActivity{
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        new EventDetector(getApplicationContext());
    }
}

Get all tracked events from SDK

public class MyApplication extends Application {

    private EventDetector eventDetector;
    List<Event> eventList = new ArrayList<>();
    
    @Override
    public void onCreate() {
        super.onCreate();
        eventDetector = new EventDetector(this);
    }

    public List<Event> getEventList() {
        eventList.addAll(eventDetector.getmEventList());
        return eventList;
    }

Exclude activity from getting tracked

public class MyApplication extends Application {
    private EventDetector eventDetector;
    @Override
    public void onCreate() {
        super.onCreate();
        ........
        /**"do not track events on below activity"**/
        eventDetector.excludeActivity("EventActivity");
    }