Skip to content

Instantly share code, notes, and snippets.

@huiliu
Created August 19, 2019 09:32
Show Gist options
  • Save huiliu/0a41b1b725be0816ac624d4c8cefc0f0 to your computer and use it in GitHub Desktop.
Save huiliu/0a41b1b725be0816ac624d4c8cefc0f0 to your computer and use it in GitHub Desktop.
import android.app.Application;
import com.kochava.base.Tracker;
import com.kochava.base.Tracker.Configuration;
public class KochavaBridge {
static void setGUID(String guid){
Tracker.configure(new Configuration(null));
}
static void setUserId(String uid){
Tracker.setIdentityLink(new Tracker.IdentityLink()
.add("User ID", uid)
.add("Login",uid)
);
}
static void purchase(String name, double price){
Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_PURCHASE)
.setPrice(price)
.setName(name)
);
}
static void adClick(String placeId, String type){
Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_AD_CLICK)
.setAdType(type)
.setAdPlacement(placeId)
);
}
static void adView(String placeId, String type){
Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_AD_VIEW)
.setAdType(type)
.setAdPlacement(placeId)
);
}
static void levelUp(int level){
Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_LEVEL_COMPLETE)
.setLevel(Integer.toString(level))
);
}
static void customEvent(String name, String info){
// Tracker.sendEvent(new Tracker.Event(Tracker.EVENT_TYPE_CONSENT_GRANTED)
// .set);
}
static void onTutorialComplete(String name, int durationS){
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment