当前位置: 首页>>代码示例>>Java>>正文


Java MixpanelAPI.getInstance方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:Microsoft,项目名称:ProjectOxford-Apps-MimickerAlarm,代码行数:27,代码来源:Logger.java

示例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();
    }
}
 
开发者ID:perludem,项目名称:DPR-KITA,代码行数:22,代码来源:SurveyActivity.java

示例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);
    }
}
 
开发者ID:bnsantos,项目名称:android-analytics-example,代码行数:20,代码来源:AnalyticsHelper.java

示例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);
    }

}
 
开发者ID:intari,项目名称:readingtracker,代码行数:21,代码来源:MyAnalytics.java

示例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();
        }

    }
}
 
开发者ID:intari,项目名称:readingtracker,代码行数:22,代码来源:MyAnalytics.java

示例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");
    }
}
 
开发者ID:intari,项目名称:readingtracker,代码行数:21,代码来源:MyAnalytics.java

示例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");
    }
}
 
开发者ID:intari,项目名称:readingtracker,代码行数:21,代码来源:MyAnalytics.java

示例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");
    }

}
 
开发者ID:intari,项目名称:readingtracker,代码行数:21,代码来源:MyAnalytics.java

示例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);
    }
 
开发者ID:AAverin,项目名称:android-skeleton-project,代码行数:21,代码来源:BaseActivity.java

示例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");
    }
}
 
开发者ID:sinhaDroid,项目名称:BlogBookApp,代码行数:12,代码来源:BlogBookAnalytics.java

示例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());
}
 
开发者ID:humaniq,项目名称:react-native-android-library-humaniq-api,代码行数:11,代码来源:ProfileModule.java

示例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());
}
 
开发者ID:humaniq,项目名称:react-native-android-library-humaniq-api,代码行数:10,代码来源:BlockchainModule.java

示例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());
}
 
开发者ID:humaniq,项目名称:react-native-android-library-humaniq-api,代码行数:10,代码来源:PhotoValidationModule.java

示例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());
}
 
开发者ID:humaniq,项目名称:react-native-android-library-humaniq-api,代码行数:10,代码来源:ContactsModule.java

示例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();
}
 
开发者ID:Webtrekk,项目名称:webtrekk-android-sdk,代码行数:39,代码来源:MainActivity.java


注:本文中的com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。