本文整理汇总了Java中com.crashlytics.android.Crashlytics.setString方法的典型用法代码示例。如果您正苦于以下问题:Java Crashlytics.setString方法的具体用法?Java Crashlytics.setString怎么用?Java Crashlytics.setString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.crashlytics.android.Crashlytics
的用法示例。
在下文中一共展示了Crashlytics.setString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: handleException
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
@Override
/**
* Exception handler with Crashlytics support, also it will be shown in logcat.
*/
public void handleException(Throwable throwable, DataMap map) {
Timber.d("HandleException %s", throwable);
Crashlytics.setBool("wear_exception", true);
Crashlytics.setString("board", map.getString("board"));
Crashlytics.setString("fingerprint", map.getString("fingerprint"));
Crashlytics.setString("model", map.getString("model"));
Crashlytics.setString("manufacturer", map.getString("manufacturer"));
Crashlytics.setString("product", map.getString("product"));
Crashlytics.setString("api_level", map.getString("api_level"));
Crashlytics.logException(throwable);
}
示例3: initFabric
import com.crashlytics.android.Crashlytics; //导入方法依赖的package包/类
public static void initFabric(@NonNull Context context) {
final Fabric.Builder fabric = new Fabric.Builder(context)
.kits(new Crashlytics(),new Answers());
fabric.debuggable(true);
Fabric.with(fabric.build());
Crashlytics.setString("com.crashlytics.android.build_id", UUID.randomUUID().toString());
}