本文整理匯總了Java中com.crashlytics.android.Crashlytics.setUserName方法的典型用法代碼示例。如果您正苦於以下問題:Java Crashlytics.setUserName方法的具體用法?Java Crashlytics.setUserName怎麽用?Java Crashlytics.setUserName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.crashlytics.android.Crashlytics
的用法示例。
在下文中一共展示了Crashlytics.setUserName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setCrashlyticsKeys
import com.crashlytics.android.Crashlytics; //導入方法依賴的package包/類
public static void setCrashlyticsKeys(Context mContext) {
try {
HyperTrackLiveUser user = OnboardingManager.sharedManager(mContext).getUser();
String apiKey = ApiKey.getApiKey(mContext);
if (!HTTextUtils.isEmpty(apiKey)) {
if (user != null) {
// Set UserID
String userID = user.getId() != null ? user.getId() : "NULL";
Crashlytics.setUserIdentifier(userID);
Crashlytics.setString(CrashlyticsKeys.USER_ID, userID);
// Set UserName
String userName = !HTTextUtils.isEmpty(user.getName()) ? user.getName() : "NULL";
Crashlytics.setUserName(userName);
Crashlytics.setString(CrashlyticsKeys.USER_NAME, userName);
// Set UserPhone & UserDeviceID
Crashlytics.setString(CrashlyticsKeys.USER_PHONE, !HTTextUtils.isEmpty(user.getPhone()) ? user.getPhone() : "NULL");
String deviceUUID = com.hypertrack.lib.internal.common.util.Utils.getDeviceId(mContext);
Crashlytics.setString(CrashlyticsKeys.USER_DEVICE_ID, !HTTextUtils.isEmpty(deviceUUID) ? deviceUUID : "NULL");
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: sendUserProperties
import com.crashlytics.android.Crashlytics; //導入方法依賴的package包/類
@Override
public void sendUserProperties(String name, String value) {
switch (name) {
case AnalyticConstant.USER_EMAIL:
Crashlytics.setUserEmail(value);
break;
case AnalyticConstant.USER_NAME:
Crashlytics.setUserName(value);
break;
case AnalyticConstant.USER_SIGN_IN:
Answers.getInstance().logLogin(new LoginEvent().putMethod(value).putSuccess(true));
break;
case AnalyticConstant.USER_SIGN_UP:
Answers.getInstance().logSignUp(new SignUpEvent().putMethod(value).putSuccess(true));
break;
default:
Answers.getInstance().logCustom(new CustomEvent("Custom_Event").putCustomAttribute(name, value));
break;
}
}