本文整理汇总了Java中com.splunk.mint.Mint.setUserIdentifier方法的典型用法代码示例。如果您正苦于以下问题:Java Mint.setUserIdentifier方法的具体用法?Java Mint.setUserIdentifier怎么用?Java Mint.setUserIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.splunk.mint.Mint
的用法示例。
在下文中一共展示了Mint.setUserIdentifier方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loginUser
import com.splunk.mint.Mint; //导入方法依赖的package包/类
public static void loginUser(Context ctx, User user){
//To ensure that userPrefs get saved, we force the logout of the current user
logoutCurrentUser(ctx);
String username = user.getUsername();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
SharedPreferences.Editor editor = prefs.edit();
editor.putString(PrefsActivity.PREF_USER_NAME, username);
editor.putString(PrefsActivity.PREF_PHONE_NO, user.getPhoneNo());
editor.putBoolean(PrefsActivity.PREF_SCORING_ENABLED, user.isScoringEnabled());
editor.putBoolean(PrefsActivity.PREF_BADGING_ENABLED, user.isBadgingEnabled());
loadUserPrefs(ctx, username, editor);
Mint.setUserIdentifier(username);
editor.apply();
}
示例2: onCreate
import com.splunk.mint.Mint; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Mint.disableNetworkMonitoring();
Mint.initAndStartSession(this, MobileLearning.MINT_API_KEY);
setContentView(R.layout.start_up);
if (MobileLearning.DEVICEADMIN_ENABLED){
boolean isGooglePlayAvailable = GooglePlayUtils.checkPlayServices(this,
new GooglePlayUtils.DialogListener() {
@Override
public void onErrorDialogClosed() {
//If Google play is not available, we need to close the app
StartUpActivity.this.finish();
}
});
if (!isGooglePlayAvailable) return;
}
tvProgress = (TextView) this.findViewById(R.id.start_up_progress);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
String username = SessionManager.getUsername(this);
Mint.setUserIdentifier( username.equals("") ? "anon" : username);
}
示例3: logoutCurrentUser
import com.splunk.mint.Mint; //导入方法依赖的package包/类
public static void logoutCurrentUser(Context ctx){
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
SharedPreferences.Editor editor = prefs.edit();
String username = getUsernameFromPrefs(prefs);
//If there was a logged in user, we save her Preferences in the DB
if (!username.equals("")){
saveUserPrefs(ctx, username, prefs);
}
//Logout the user (unregister from Preferences)
editor.putString(PrefsActivity.PREF_USER_NAME, "");
Mint.setUserIdentifier("anon");
editor.apply();
}