Android Utililty Methods ID Generate

List of utility methods to do ID Generate

Description

The list of methods to do ID Generate are organized into topic(s).

Method

StringgenerateSyncEventId()
generate Sync Event Id
if (sequence == Long.MAX_VALUE)
    sequence = 0;
return convertLongToDateString(System.currentTimeMillis(),
        "yyyy-MM-dd hh:mm:ss")
        + "-"
        + String.format("%20d", sequence++);
StringgetSequenceId()
get Sequence Id
String mark = String.valueOf(System.currentTimeMillis());
return mark;
longgenerateId(Object... value)
generate Id
try {
    StringBuilder builder = new StringBuilder();
    for (Object s : value) {
        builder.append(String.valueOf(s));
    MessageDigest md = MessageDigest.getInstance("sha-1");
    md.update(builder.toString().getBytes());
    byte[] hashValBytes = md.digest();
...
longgenerateId(Object... value)
generate Id
if (md == null) {
    return 0L;
StringBuilder builder = new StringBuilder();
for (Object s : value) {
    builder.append(String.valueOf(s));
byte[] hashValBytes;
...
StringgenerateRecordingIdentifier()
generate Recording Identifier
return UUID.randomUUID().toString();
StringgetAndroidId(Context context)
get Android Id
String androidId = android.provider.Settings.Secure.getString(
        context.getContentResolver(),
        android.provider.Settings.Secure.ANDROID_ID);
if (androidId != null)
    return getHash(androidId);
return null;
StringgenerateKey()
generate Key
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
        "yyyy-MM-dd-HH-mm-ss-SSS");
return simpleDateFormat.format(Calendar.getInstance().getTime());
StringgenerateRandomUIID()
generate Random UIID
UUID uniqueKey = UUID.randomUUID();
return uniqueKey.toString();