public class Util
extends java.lang.Object
| 构造器和说明 |
|---|
Util() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.lang.String |
base64Encode(java.lang.String string)
Encodes a string into Base64.
|
static java.lang.String |
getCarrier(android.content.Context context)
Returns the carrier name based
on the android context supplied.
|
static java.lang.String |
getEventId()
Generates a random UUID for
each event.
|
static android.location.Location |
getLocation(android.content.Context context)
Returns the location of the android
device.
|
static java.lang.String |
getTimestamp()
Returns the current System time
as a String.
|
static long |
getUTF8Length(java.lang.String s)
Count the number of bytes a string will occupy when UTF-8 encoded
|
static boolean |
isOnline(android.content.Context context)
Checks whether or not the device
is online and able to communicate
with the outside world.
|
static boolean |
isTimeInRange(long startTime,
long checkTime,
long range)
The startTime must be greater than the endTime minus the
interval to be within an acceptable range.
|
static org.json.JSONObject |
mapToJSONObject(java.util.Map map)
Converts a Map to a JSONObject
|
public static org.json.JSONObject mapToJSONObject(java.util.Map map)
map - The map to convertpublic static long getUTF8Length(java.lang.String s)
s - the String to processpublic static java.lang.String base64Encode(java.lang.String string)
string - the string too encodepublic static java.lang.String getTimestamp()
public static boolean isOnline(android.content.Context context)
context - the android contextpublic static java.lang.String getCarrier(android.content.Context context)
context - the android contextpublic static android.location.Location getLocation(android.content.Context context)
context - the android contextpublic static boolean isTimeInRange(long startTime,
long checkTime,
long range)
startTime - the startTime of the checkcheckTime - the time of the checkrange - the allowed range the startTime must be inpublic static java.lang.String getEventId()