本文整理匯總了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());
}