/**
* @author Sebastien Lorber <i>(lorber.sebastien@gmail.com)</i>
*/
public enum EnumDeviceType {
ANDROID {
@Override
public boolean validateDeviceIdentifier(String deviceIdentifier) {
Preconditions.checkArgument( !Strings.isNullOrEmpty(deviceIdentifier) );
return ANDROID_REGISTRATION_ID_PATTERN.matcher(deviceIdentifier).matches();
}
},
IOS {
@Override
public boolean validateDeviceIdentifier(String deviceIdentifier) {
Preconditions.checkArgument( !Strings.isNullOrEmpty(deviceIdentifier) );
return IOS_DEVICE_TOKEN_PATTERN.matcher(deviceIdentifier).matches();
}
},
;
// TODO how do we validate registration Ids
public static final Pattern ANDROID_REGISTRATION_ID_PATTERN = Pattern.compile(".*");
// IOS device token is a 64 HEX string
public static final Pattern IOS_DEVICE_TOKEN_PATTERN = Pattern.compile("[a-fA-F0-9]{64,64}");
public abstract boolean validateDeviceIdentifier(String deviceIdentifier);
public boolean isIos() {
return IOS.equals(this);
}
public boolean isAndroid() {
return ANDROID.equals(this);
}
}
是否有任何已知的 GCM registrationId 模式可以用来在应用程序上验证registrationId 具有正确的形状?我只想知道它有哪些字符范围,例如最小和最大大小......或任何其他信息......