本文整理汇总了Java中com.hypertrack.lib.models.UserParams类的典型用法代码示例。如果您正苦于以下问题:Java UserParams类的具体用法?Java UserParams怎么用?Java UserParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UserParams类属于com.hypertrack.lib.models包,在下文中一共展示了UserParams类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserParams
import com.hypertrack.lib.models.UserParams; //导入依赖的package包/类
private UserParams getUserParams(final Context context, final String name, final String number, String ISOCode, File profileImage)
throws NumberParseException {
final HyperTrackLiveUser user = this.onboardingManager.getUser();
// Update Country Code from device's current location
if (!HTTextUtils.isEmpty(ISOCode))
user.setCountryCode(ISOCode);
String encodedImage = null;
// Set user's profile image
if (profileImage != null && profileImage.length() > 0) {
user.setPhotoImage(profileImage);
byte[] bytes = convertFiletoByteArray(profileImage);
if (bytes != null && bytes.length > 0)
encodedImage = Base64.encodeToString(bytes, Base64.DEFAULT);
}
HyperTrackLiveUser.setHyperTrackLiveUser(context);
String phoneNumber = user.getInternationalNumber(number);
return new UserParams()
.setName(name)
.setPhone(phoneNumber)
.setPhoto(encodedImage)
.setLookupId(phoneNumber);
}
示例2: attemptLogin
import com.hypertrack.lib.models.UserParams; //导入依赖的package包/类
@Override
public void attemptLogin(final String userName, final String phone, String ISOCode,
final File profileImage, final boolean verifyPhone, final Context context) {
try {
UserParams userParams = getUserParams(context, userName, phone, ISOCode, profileImage);
HyperTrack.getOrCreateUser(userParams, new HyperTrackCallback() {
@Override
public void onSuccess(@NonNull SuccessResponse successResponse) {
Log.d(TAG, "onSuccess: User Created");
if (verifyPhone && !HTTextUtils.isEmpty(BuildConfig.isHyperTrackLive)) {
sendVerificationCode(context);
} else
view.onProfileUpdateSuccess();
}
@Override
public void onError(@NonNull ErrorResponse errorResponse) {
Log.d(TAG, "onError: User Created:" + errorResponse.getErrorMessage());
if (view != null)
view.showErrorMessage(errorResponse.getErrorMessage());
}
});
} catch (Exception e) {
e.printStackTrace();
if (view != null)
view.showErrorMessage(e.getMessage());
}
}
示例3: updateProfile
import com.hypertrack.lib.models.UserParams; //导入依赖的package包/类
@Override
public void updateProfile(final String name, final String number, String ISOCode, File profileImage,
final boolean verifyPhone, final Context context) {
try {
UserParams userParams = getUserParams(context, name, number, ISOCode, profileImage);
HyperTrack.updateUser(userParams, new HyperTrackCallback() {
@Override
public void onSuccess(@NonNull SuccessResponse successResponse) {
Log.d(TAG, "onSuccess: User Profile Updated");
if (verifyPhone && !HTTextUtils.isEmpty(BuildConfig.isHyperTrackLive)) {
sendVerificationCode(context);
} else if (view != null)
view.onProfileUpdateSuccess();
}
@Override
public void onError(@NonNull ErrorResponse errorResponse) {
Log.d(TAG, "onError: UpdateUser:" + errorResponse.getErrorMessage());
if (view != null)
view.showErrorMessage(errorResponse.getErrorMessage());
}
});
} catch (Exception e) {
e.printStackTrace();
if (view != null)
view.showErrorMessage(e.getMessage());
}
}
示例4: attemptDriverLogin
import com.hypertrack.lib.models.UserParams; //导入依赖的package包/类
/**
* Call this method to attempt driver login. This method will create a User on HyperTrack Server
* and configure the SDK using this generated UserId.
*/
private void attemptDriverLogin() {
// Show Login Button loader
loginBtnLoader.setVisibility(View.VISIBLE);
// Get Driver details, if provided
final String name = driverNameText.getText().toString();
final String phoneNumber = driverPhoneNumberText.getText().toString();
// PhoneNumber is used as the lookup_id here but you can specify any other entity as the lookup_id.
final String lookupId = HTTextUtils.isEmpty(phoneNumber)? UUID.randomUUID().toString():phoneNumber;
/**
* Create a User on HyperTrack Server here to login your driver & configure HyperTrack SDK with
* this generated HyperTrack UserId.
* OR
* Implement your API call for Driver Login and get back a HyperTrack UserId from your API Server
* to be configured in the HyperTrack SDK.
*
* @NOTE:
* Specify Driver name, phone number and a lookup_id denoting your driver's internal id.
* PhoneNumber is used as the lookup_id here but you can specify any other entity as the lookup_id.
*/
UserParams userParams = new UserParams().setName(name).setPhone(phoneNumber).setLookupId(lookupId);
HyperTrack.getOrCreateUser(userParams, new HyperTrackCallback() {
@Override
public void onSuccess(@NonNull SuccessResponse successResponse) {
// Hide Login Button loader
loginBtnLoader.setVisibility(View.GONE);
User user = (User) successResponse.getResponseObject();
// Handle createUser success here, if required
// HyperTrack SDK auto-configures UserId on createUser API call, so no need to call
// HyperTrack.setUserId() API
// On DriverLogin success
onDriverLoginSuccess();
}
@Override
public void onError(@NonNull ErrorResponse errorResponse) {
// Hide Login Button loader
loginBtnLoader.setVisibility(View.GONE);
Toast.makeText(LoginActivity.this, R.string.login_error_msg + " " + errorResponse.getErrorMessage(),
Toast.LENGTH_SHORT).show();
}
});
}