public class DeviceCore
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
DeviceCore.TimeGenerator
General interface for time generators.
|
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.Long |
BYTES_IN_MB |
static DeviceCore |
dev |
protected static Log.Module |
L |
protected static java.lang.Double |
MS_IN_SECOND |
protected static java.lang.Double |
NS_IN_MS |
protected static java.lang.Double |
NS_IN_SECOND
One second in nanoseconds
|
protected DeviceCore.TimeGenerator |
uniformTimer |
protected DeviceCore.TimeGenerator |
uniqueTimer |
| Modifier | Constructor and Description |
|---|---|
protected |
DeviceCore() |
| Modifier and Type | Method and Description |
|---|---|
Params |
buildMetrics(CtxCore ctx)
Build metrics
Params object as required by Countly server |
int |
currentDayOfWeek()
Get current day of week
|
int |
currentHour()
Get current hour of day
|
java.lang.Long |
getDiskAvailable()
Get current device disk space.
|
java.lang.Long |
getDiskTotal()
Get total device disk space.
|
java.lang.String |
getLocale()
Get current locale
|
java.lang.String |
getOS()
Get operation system name
|
java.lang.String |
getOSVersion()
Get Android version
|
java.lang.Long |
getRAMAvailable()
Get current device RAM amount.
|
java.lang.Long |
getRAMTotal()
Get total RAM in Mb
|
int |
getTimezoneOffset()
Get device timezone offset in seconds
|
boolean |
isDebuggerConnected() |
long |
nsToMs(long ns)
Convert time in nanoseconds to milliseconds
|
long |
nsToSec(long ns)
Convert time in nanoseconds to seconds
|
long |
secToMs(long sec)
Convert time in seconds to milliseconds
|
long |
secToNs(long sec)
Convert time in seconds to nanoseconds
|
long |
uniformTimestamp()
Wraps
System.currentTimeMillis() to return always rising values. |
long |
uniqueTimestamp()
Wraps
System.currentTimeMillis() to always return different value, even within
same millisecond and even when time changes. |
public static DeviceCore dev
protected static final Log.Module L
protected static final java.lang.Double NS_IN_SECOND
protected static final java.lang.Double NS_IN_MS
protected static final java.lang.Double MS_IN_SECOND
protected static final java.lang.Long BYTES_IN_MB
protected DeviceCore.TimeGenerator uniqueTimer
protected DeviceCore.TimeGenerator uniformTimer
public java.lang.String getOS()
public java.lang.String getOSVersion()
public int getTimezoneOffset()
public java.lang.String getLocale()
public Params buildMetrics(CtxCore ctx)
Params object as required by Countly serverctx - Ctx in which to request metricspublic long uniqueTimestamp()
System.currentTimeMillis() to always return different value, even within
same millisecond and even when time changes. Works in a limited window of 10 timestamps for now.public long uniformTimestamp()
System.currentTimeMillis() to return always rising values.
Resolves issue with device time updates via NTP or manually where time must go up.public int currentDayOfWeek()
public int currentHour()
public long nsToMs(long ns)
ns - time in nanosecondspublic long nsToSec(long ns)
ns - time in nanosecondspublic long secToNs(long sec)
sec - time in secondspublic long secToMs(long sec)
sec - time in secondspublic java.lang.Long getRAMTotal()
public java.lang.Long getRAMAvailable()
null if couldn't determinepublic java.lang.Long getDiskAvailable()
public java.lang.Long getDiskTotal()
public boolean isDebuggerConnected()