Changed android UUID flow, again
This commit is contained in:
@@ -108,21 +108,6 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
String s = Secure.getString(getContext().getContentResolver(),
|
String s = Secure.getString(getContext().getContentResolver(),
|
||||||
Secure.ANDROID_ID);
|
Secure.ANDROID_ID);
|
||||||
|
|
||||||
if(s == null){
|
|
||||||
Settings.defaults("uuid", "");
|
|
||||||
|
|
||||||
String uuid = Settings.getString("uuid");
|
|
||||||
if(uuid.isEmpty()){
|
|
||||||
byte[] result = new byte[8];
|
|
||||||
new Random().nextBytes(result);
|
|
||||||
uuid = new String(Base64Coder.encode(result));
|
|
||||||
Settings.putString("uuid", uuid);
|
|
||||||
Settings.save();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return Base64Coder.decode(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
int len = s.length();
|
int len = s.length();
|
||||||
byte[] data = new byte[len / 2];
|
byte[] data = new byte[len / 2];
|
||||||
for (int i = 0; i < len; i += 2) {
|
for (int i = 0; i < len; i += 2) {
|
||||||
@@ -132,7 +117,18 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return null;
|
Settings.defaults("uuid", "");
|
||||||
|
|
||||||
|
String uuid = Settings.getString("uuid");
|
||||||
|
if(uuid.isEmpty()){
|
||||||
|
byte[] result = new byte[8];
|
||||||
|
new Random().nextBytes(result);
|
||||||
|
uuid = new String(Base64Coder.encode(result));
|
||||||
|
Settings.putString("uuid", uuid);
|
||||||
|
Settings.save();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return Base64Coder.decode(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Thu Mar 08 20:46:47 EST 2018
|
#Thu Mar 08 22:36:02 EST 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=357
|
androidBuildCode=359
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.4
|
code=3.4
|
||||||
build=33
|
build=custom build
|
||||||
|
|||||||
Reference in New Issue
Block a user