public class Swirl
extends java.lang.Object
SwirlListener| Modifier and Type | Class and Description |
|---|---|
static class |
Swirl.BackgroundEvent
Event sent when the application goes into the background.
|
static class |
Swirl.DeviceChanged
A subclass of Receiver for device related events.
|
static class |
Swirl.ErrorEvent
Event sent when Swirl reports an error
|
static class |
Swirl.ForegroundEvent
Event sent when the application comes into the foreground.
|
static class |
Swirl.LocationChanged
A subclass of Receiver for location related events.
|
static class |
Swirl.Receiver
Base class for all BroadcastReceivers.
|
static class |
Swirl.Service
This service class presents a STICKY service which runs in the background after the application
has been terminated or has no visible activities in the foreground.
|
static class |
Swirl.StartedEvent
Event sent when Swirl started without error.
|
static class |
Swirl.StatusChangedEvent
Event sent when Swirl status changes.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
STATUS_BLUETOOTH
If this bit is set, Bluetooth Services are available.
|
static int |
STATUS_DEVICE_MASK
A bit mask for accessing device status portion
|
static int |
STATUS_ERROR
If this bit is set, the system has reported an error, which is available in the error property.
|
static int |
STATUS_LOCATION
If this bit is set, Location Services are authorized.
|
static int |
STATUS_NETWORK
If this bit is set, Network Services are available.
|
static int |
STATUS_NONE
This value indicates that the system is not running.
|
static int |
STATUS_NOTIFICATIONS
If this bit is set, Notifications are enabled.
|
static int |
STATUS_PENDING
If this bit is set, the system is transitioning from Stopped to Running or the reverse.
|
static int |
STATUS_RUNNING
If this bit is set, the system is either Running or if Pending is also set, Stopping.
|
static int |
STATUS_SWIRL_MASK
A bit mask for accessing Swirl status portion
|
| Modifier and Type | Method and Description |
|---|---|
Swirl |
addListener(java.lang.Object listener)
Add a listener to the internal listener bus.
|
Swirl |
addListener(java.lang.Object listener,
java.util.concurrent.Executor executor)
Add a listener to the internal listener bus, specifying an executor.
|
static boolean |
checkApiVersions() |
java.lang.Object |
findListener(java.lang.Class aclass)
Find the first registered listener of a given class.
|
int |
getError()
Return the library's last recorded error.
|
static Swirl |
getInstance()
Return the shared singleton, assuming it has already been created.
|
static Swirl |
getInstance(android.content.Context c)
Return the shared singleton, assuming it has already been created.
|
static Swirl |
getInstance(android.content.Context c,
java.lang.Class[] listeners)
Return the shared singleton, assuming it has already been created.
|
android.location.Location |
getLocation()
Return the library's internal location object.
|
int |
getStatus()
Return the library's running status.
|
org.json.JSONObject |
getUserInfo()
* Get the currently stored user-info attributes.
|
java.lang.String |
getUserKey()
Returns a string representation of the UUID that the library generates for this device.
|
java.lang.String |
getVersion()
Get the current version (as a string) of the library.
|
Swirl |
logEvent(java.lang.String event,
java.lang.String data)
Log event to the log stream.
|
void |
onLocationChange(Device.LocationChangedEvent event) |
void |
permissionsChanged()
Informs the SDK that the user has changed permissions and to re-initialize
things that depend on dynamic permissions
|
Swirl |
post(java.lang.Object object)
Post an object to the internal message bus.
|
Swirl |
removeListener(java.lang.Object listener)
Remove a listener that had been previously added via addListener().
|
Swirl |
reset()
Removes all locally stored data and state.
|
Swirl |
setBackgroundMode(boolean background)
Sets the current operating mode to foreground or background.
|
Swirl |
setOptions(android.os.Bundle options)
Pushes a bundle of property value pairs into Settings.
|
void |
setUserInfo(org.json.JSONObject info)
Set the currently store user attributes
|
Swirl |
start(android.os.Bundle options)
Starts the sdk and all loaded managers.
|
Swirl |
stop()
Stops the sdk.
|
Swirl |
streamMessage(org.json.JSONObject message)
Publish a message to the live event stream.
|
public static final int STATUS_NONE
public static final int STATUS_RUNNING
public static final int STATUS_PENDING
public static final int STATUS_ERROR
public static final int STATUS_LOCATION
public static final int STATUS_BLUETOOTH
public static final int STATUS_NETWORK
public static final int STATUS_NOTIFICATIONS
public static final int STATUS_SWIRL_MASK
public static final int STATUS_DEVICE_MASK
public static Swirl getInstance()
public static Swirl getInstance(android.content.Context c)
c - Application contextpublic static Swirl getInstance(android.content.Context c, java.lang.Class[] listeners)
c - Application contextlisteners - An array of listener classes.public Swirl setOptions(android.os.Bundle options)
options - A Bundle containing property, value pairs of system settings or settings that
can be used by custom listeners or managers.public Swirl setBackgroundMode(boolean background)
background - A boolean value indicating which mode to be in.public Swirl addListener(java.lang.Object listener)
listener - The object to receive listener callbacks. This parameter must not be `null`.removeListener(Object),
addListener(Object, Executor)public Swirl addListener(java.lang.Object listener, java.util.concurrent.Executor executor)
listener - The object to receive listener callbacks. This parameter must not be `null`.executor - The executor on which messages should be delivered. This parameter must not be `null`.removeListener(Object),
addListener(Object)public Swirl removeListener(java.lang.Object listener)
listener - The object to receive listener callbacks. This parameter must not be `null`.addListener(Object),
addListener(Object, Executor)public java.lang.Object findListener(java.lang.Class aclass)
aclass - Class of the listener to findpublic android.location.Location getLocation()
public int getError()
public int getStatus()
public java.lang.String getUserKey()
public org.json.JSONObject getUserInfo()
public void setUserInfo(org.json.JSONObject info)
info - The attributes to store for the current user.public java.lang.String getVersion()
public Swirl start(android.os.Bundle options)
options - all of the startup options (see x)public void permissionsChanged()
public Swirl stop()
public Swirl post(java.lang.Object object)
object - the object to postpublic Swirl logEvent(java.lang.String event, java.lang.String data)
event - The event name (see the list of known events)data - The data for event (see the list of events)public Swirl streamMessage(org.json.JSONObject message)
message - a JSON object to put on the streampublic Swirl reset()
public static boolean checkApiVersions()
public void onLocationChange(Device.LocationChangedEvent event)