Initialize a FlurryAgent after onCreate()
using:
FlurryAgent.init(YourClass.this, "YOUR_API_KEY");
Start / End your sessions using: (This will come in your activity class)
@Override
protected void onStart() {
super.onStart();
FlurryAgent.onStartSession(YourClass.this, "YOUR_API_KEY");
}
@Override
protected void onStop() {
super.onStop();
FlurryAgent.onEndSession(YourClass.this);
}
Now add this line where ever you want to log the event:
FlurryAgent.logEvent("Your_event_name");
To log events with some parameters, use:
HashMap<String, String> myMap = new HashMap<String, String>();
myMap.put("key", "value");
FlurryAgent.logEvent("even_name", myMap);
Hope this will help somebody.
NOTE: If you come across the two terms FlurryAgent.logEvent
and FlurryAgent.onEvent
, use .logEvent
.onEvent
is deprecated. Reference here