本文整理汇总了Java中com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java MixpanelAPI.getInstance方法的具体用法?Java MixpanelAPI.getInstance怎么用?Java MixpanelAPI.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mixpanel.android.mpmetrics.MixpanelAPI
的用法示例。
在下文中一共展示了MixpanelAPI.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
public static void init(Context caller){
sContext = caller;
if (!sStarted && isLogging()) {
String android_id = Secure.getString(caller.getContentResolver(), Secure.ANDROID_ID);
try {
sMixpanelToken = KeyUtilities.getToken(caller, "mixpanel");
if (sMixpanelToken == null || sMixpanelToken.equals("")){
sStarted = false;
return;
}
sStarted = true;
MixpanelAPI mixpanel = MixpanelAPI.getInstance(sContext, sMixpanelToken);
mixpanel.identify(android_id);
mixpanel.getPeople().identify(android_id);
mixpanel.getPeople().set("name", android_id);
mixpanel.getPeople().set("Build Version", BuildConfig.VERSION_NAME);
mixpanel.getPeople().setMap(Collections.<String, Object>unmodifiableMap(mixpanel.getDeviceInfo()));
}
catch (Exception ex){
trackException(ex);
}
}
}
示例2: onCreate
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mIntentId = getIntent().getIntExtra(INTENT_ID_KEY, Integer.MAX_VALUE);
mUpdateDisplayState = UpdateDisplayState.claimDisplayState(mIntentId);
if (null == mUpdateDisplayState) {
Log.e(LOGTAG, "SurveyActivity intent received, but nothing was found to show.");
finish();
return;
}
mMixpanel = MixpanelAPI.getInstance(SurveyActivity.this, mUpdateDisplayState.getToken());
if (isShowingInApp()) {
onCreateInAppNotification(savedInstanceState);
} else if (isShowingSurvey()) {
onCreateSurvey(savedInstanceState);
} else {
finish();
}
}
示例3: initMixPanel
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
private void initMixPanel() {
if (Constants.enableMixPanel) {
mMixpanelAPI = MixpanelAPI.getInstance(mContext, Constants.getMixpanelToken());
mMixpanelAPI.identify(Constants.getCurrentUserId());
mMixpanelAPI.getPeople().set("last_login", Calendar.getInstance().getTime());
mMixpanelAPI.getPeople().set("name", Constants.getCurrentUser());
mMixpanelAPI.getPeople().set("gender", "female");
mMixpanelAPI.getPeople().set("company", Constants.getCurrentCompany());
mMixpanelAPI.alias(Constants.getCurrentUserId(), Constants.getCurrentUser());
JSONObject props = new JSONObject();
try {
props.put("User Type", "Crazy woman");
} catch (JSONException e) {
e.printStackTrace();
}
mMixpanelAPI.registerSuperProperties(props);
}
}
示例4: init
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
public static void init(MyApplication newApp,Context context) {
Log.d(TAG, "init");
//we sometimes gets called twice (from app startup and from main activity)
if (app==null) {
app=newApp;
}
if (storedContext==null) {
storedContext=context;
}
if (AppHelpers.isRunningTestBuild()) {
Log.d(TAG,"Automatically disabling analytics in test build");
MyApplication.setAnalyticsEnabled(false);
}
if (MyApplication.isAnalyticsEnabled()) {
//Mixpanel
MixpanelAPI mixpanel = MixpanelAPI.getInstance(storedContext,BuildConfig.MIXPANEL_TOKEN);
}
}
示例5: stopAnalytics
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
/**
* pauses 3rd party analytics (and possibile stops). for analytics systems which don't need context
*/
public static void stopAnalytics() {
if (MyApplication.isAnalyticsEnabled()) {
Log.d(TAG,"stopAnalytics()");
if (storedContext==null) {
Log.d(TAG,"null storedContext");
return;
}
MixpanelAPI mixpanel = MixpanelAPI.getInstance(storedContext,BuildConfig.MIXPANEL_TOKEN);
if (mixpanel==null) {
Log.d(TAG,"null mixpanel?!");
Rollbar.reportMessage("stopAnalytics() - mixpanel is null", "info");
}
else {
mixpanel.flush();
}
}
}
示例6: trackTimedEventStart
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
/**
* Signals start of timed event to 3rd-party analytics systems.
* Currently only Mixpanel is supported
* @param name - event name
*/
public static void trackTimedEventStart(String name) {
if (app==null) {
Log.e(TAG,"trackTimedEventStart: app is null");
return;
}
//don't track anything if this is disabled on global level
if (MyApplication.isAnalyticsEnabled()) {
Log.d(TAG,"Sending start of event "+name+" to analytics service");
MixpanelAPI mixpanel = MixpanelAPI.getInstance(storedContext,BuildConfig.MIXPANEL_TOKEN);
mixpanel.timeEvent(name);
}
else {
Log.d(TAG,"trackTimedEventStart not sending event " + name + " to analytics service");
}
}
示例7: trackTimedEventStop
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
/**
* Signals stop of timed event to 3rd-party analytics systems.
* Currently only Mixpanel is supported
* @param name - event name
*/
public static void trackTimedEventStop(String name) {
if (app==null) {
Log.e(TAG,"trackTimedEventStop: app is null");
return;
}
//don't track anything if this is disabled on global level
if (MyApplication.isAnalyticsEnabled()) {
Log.d(TAG,"Sending stop of event "+name+" (with dimensions) to analytics service");
MixpanelAPI mixpanel = MixpanelAPI.getInstance(storedContext,BuildConfig.MIXPANEL_TOKEN);
mixpanel.track(name);
}
else {
Log.d(TAG, "trackTimedEventStop not sending event " + name + " (with dimensions) to analytics service");
}
}
示例8: trackEvent
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
/**
* Signals event to be recorded by 3rd-party analytics systems.
* @param name - event name
*/
public static void trackEvent(String name) {
if (app==null) {
Log.e(TAG,"trackEvent: app is null");
return;
}
//don't track anything if this is disabled on global level
if (MyApplication.isAnalyticsEnabled()) {
Log.d(TAG,"Sending event "+name+" to analytics service");
MixpanelAPI mixpanel = MixpanelAPI.getInstance(storedContext,BuildConfig.MIXPANEL_TOKEN);
mixpanel.track(name);
}
else {
Log.d(TAG, "trackEvent not sending event " + name + " to analytics service");
}
}
示例9: onCreate
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
activityState = ActivityState.created;
uiHandler = new Handler();
baseContext = (BaseContext) getApplicationContext();
loading = LoadingOverlay.getInstance();
// Mint.initAndStartSession(this, Config.BUGSENSE_API_KEY);
// Mint.addExtraData("activity", this.getClass().getName());
mixpanelAPI = MixpanelAPI.getInstance(this, Config.MIXPANEL_API_KEY);
// ActionBar actionBar = getActionBar();
// actionBar.setDisplayShowTitleEnabled(false);
// actionBar.setDisplayShowCustomEnabled(true);
}
示例10: init
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
public void init(Context context, boolean optOut) {
GoogleAnalytics ga = GoogleAnalytics.getInstance(context);
ga.setAppOptOut(optOut);
if (!optOut) {
// Initializing the google analytics
this.mTracker = ga.newTracker(R.xml.app_tracker);
// Initializing the mixpanelapi analytics
this.mMixpanelAPI = MixpanelAPI.getInstance(context, "0f9f5280a4fb76478215544e42fa1299");
}
}
示例11: ProfileModule
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
public ProfileModule(ReactApplicationContext reactContext) {
super(reactContext);
new Prefs(reactContext);
ServiceBuilder.init(Constants.BASE_URL, reactContext);
registerMessageHandler();
mixpanel = MixpanelAPI.getInstance(reactContext, Constants.MIXPANEL_TOKEN);
mixpanel.identify(Prefs.getAccountId());
mixpanel.getPeople().identify(mixpanel.getDistinctId());
}
示例12: BlockchainModule
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
public BlockchainModule(ReactApplicationContext reactContext) {
super(reactContext);
new Prefs(reactContext);
ServiceBuilder.init(Constants.BASE_URL, reactContext);
mixpanel = MixpanelAPI.getInstance(reactContext, Constants.MIXPANEL_TOKEN);
mixpanel.identify(Prefs.getAccountId());
mixpanel.getPeople().identify(mixpanel.getDistinctId());
}
示例13: PhotoValidationModule
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
public PhotoValidationModule(ReactApplicationContext reactContext) {
super(reactContext);
new Prefs(reactContext);
ServiceBuilder.init(Constants.BASE_URL, reactContext);
mixpanel = MixpanelAPI.getInstance(reactContext, Constants.MIXPANEL_TOKEN);
mixpanel.identify(Prefs.getAccountId());
mixpanel.getPeople().identify(mixpanel.getDistinctId());
}
示例14: ContactsModule
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
public ContactsModule(ReactApplicationContext reactContext) {
super(reactContext);
new Prefs(reactContext);
ServiceBuilder.init(Constants.BASE_URL, reactContext);
mixpanel = MixpanelAPI.getInstance(reactContext, Constants.MIXPANEL_TOKEN);
mixpanel.identify(Prefs.getAccountId());
mixpanel.getPeople().identify(mixpanel.getDistinctId());
}
示例15: onCreate
import com.mixpanel.android.mpmetrics.MixpanelAPI; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState != null){
mAdClearOn = savedInstanceState.getBoolean(ADCLEAR_SIGN);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
mediaCodeReceiverRegister();
final String permissions[] = {"android.permission.READ_CONTACTS", "android.permission.READ_EXTERNAL_STORAGE",
"android.permission.WRITE_EXTERNAL_STORAGE"};
final String permissionsUI[] = {"Permission Read Contact Granted", "Permission Read External Storage Granted",
"Permission Write External Storage Granted"};
final Runnable runnables[] = {new Runnable() {
@Override
public void run() {
webtrekk = initWithNormalParameter();
webtrekk.getCustomParameter().put("own_para", "my-value");
}
}, null, null};
permissionRequest(permissions, permissionsUI, runnables);
((TextView)findViewById(R.id.main_version)).setText(getString(R.string.hello_world) + "\nLibrary Version:" + Webtrekk.mTrackingLibraryVersionUI);
MixpanelAPI mixpanel = MixpanelAPI.getInstance(this, "9e956a2e5169ddb44eb87b6acb0eee95");
updateAdClearCaption();
}