private
static String newUUID() {
return
UUID.randomUUID().toString();
}
private
static String getLocaleCountry() {
return
java.util.Locale.getDefault().getCountry();
}
private
static String getLocaleLanguage() {
return
java.util.Locale.getDefault().getLanguage();
}
private
static long getTimeZoneOffset( long
time) {
// TimeZone.getOffset() returns milliseconds. We want seconds.
return
java.util.TimeZone.getDefault().getOffset(time) / 1000 ;
}
private
static String getTimeZoneName() {
return
java.util.TimeZone.getDefault().getDisplayName(
false , java.util.TimeZone.SHORT, java.util.Locale.getDefault());
}
private
static long getFreeDiskSpace() {
android.os.StatFs s = new
android.os.StatFs(
android.os.Environment.getDataDirectory().getAbsolutePath());
return
( long )s.getAvailableBlocks() * ( long )s.getBlockSize();
}
private
static long getTotalDiskSpace() {
android.os.StatFs s = new
android.os.StatFs(
android.os.Environment.getDataDirectory().getAbsolutePath());
return
( long )s.getBlockCount() * ( long )s.getBlockSize();
}
private
String getPhoneNumberCountryCode() {
try
{
android.telephony.TelephonyManager tm = (android.telephony.TelephonyManager)
getSystemService(Context.TELEPHONY_SERVICE);
try
{
return
tm.getNetworkCountryIso();
} catch
(Exception e) {
return
tm.getSimCountryIso();
}
} catch
(Exception e) {
return
java.util.Locale.getDefault().getCountry();
}
}
|