public void registerMe(boolean force) { if (uuid != null && (!isRegistered || force)) { // Unless were forcing this registration, We need to make sure we're giving the server a // proper amount of time to register us. 90 seconds. if (registrationTimeout > Common.getEpoch() - 90 && !force) return; registrationTimeout = Common.getEpoch(); if (!Common.isValidMD5(uuid)) { Log.i(TAG, "Device Registration: FAILED! - UUID is not valid"); LaunchActivity.cookToast("Device Registration: FAILED! - UUID is not valid"); isRegistered = false; uuid = null; // We have no UUID stored in our preferences. Have the server assign us one. // String seed = Settings.Secure.getString( // LaunchActivity.getInstance().getContentResolver(), "android_id" ); // if ( seed == null ) // seed = UUID.randomUUID().toString(); // mConnection.sendPacket( new UUIDRequestPacket( seed ) ); } else { Log.i(TAG, "Device Registration: Send Registration to Server"); mConnection.sendPacket(new RegistrationPacket(uuid)); } } }
public String getDeviceState() { if (uuid == null || !Common.isValidMD5(uuid)) { return "Unregistered!"; } else { if (isRegistered) { return "Registered!"; } else { return "Pending Registration!"; } } }