Context APIs
APIs for facilitating context info access to developers
Context360 SDK provides access to the locally stored context info so that the developers can use it for their own purposes. The following APIs are available in v2.5.3
Location
API to return all location sessions.
// Signature
public static ArrayList<LocInfo> getLocationActivity(Context context);
// Call
ArrayList<LocInfo> lList = ScioContext.getLocationActivity(context);
// Returns
public class LocInfo {
public String lname; // Location name
public String lid; // Unique ID for the location
public long start_time; // unixtime in secs
public long end_time; // unixtime in secs
public double lat; // Latitude in decimal degrees
public double lon; // Longitude in decimal degrees
}
Fences (Geo and Beacon)
API to return fence lists and stats
// Signature
public static ArrayList<ScioFence> getFenceList(Context context);
// Call
ArrayList<ScioFence> sFences = getFenceList(context);
// Returns
public class ScioFence {
public String getType(); // Beacon or Geofence
public String getId(); // Beacon or Geofence id (from dashboard)
public int getRId(); // Rule id (from dashboard)
public double getLatMaj(); // Latitude(geofence) / major (beacon)
public double getLonMin(); // Longiture(geofence) / minor (beacon)
public String getLabel(); // Fence label
public double getMinRadiusRssi(); // Min radius(geofence) / Min Rssi (beacon)
public double getMaxRadiusRssi(); // Max radius(geofence) / Max Rssi (beacon)
public int getBounceTime(); // Bounce time set (from dashboard)
public List<LatLng> getVertices(); // Get vertices for polygon geofence
}
API get a list of all registered fences
// Signature
public static HashMap<String, int[]> getFenceStats(Context context);
// Call
HashMap<String, int[]> fenceStats = ScioContext.getFenceStats(context);
// Returns
HashMap<
String, // Fence id
int[4] // 0. Walk-in Count 1. Bounce count, 2. Drive-By count, 3. Dwell time in secs
>
API get stats of the registered fences
Notifications
API to return rule notifications. These are logged when a rule gets executed. This is used mostly for debugging purposes.
// Signature
public static ArrayList<RuleLogInfo> getNotifications(Context context);
// Call
ArrayList<RuleLogInfo> activityItems = ScioContext.getNotifications(context);
// Returns
public class RuleLogInfo {
public int getRuleId(); // Rule id (from dashboard)
public String getRuleData(); // Rule notification message
public long getTimestamp(); // unixtime in secs
}
Applytics
API to return all app sessions.
Restricted API
This is available only on Android and Applytics needs to be
true
on Dashboards' settings page of your App.
// Signature
public static ArrayList<AppUsageInfo> getAppActivity(Context context);
// Call
ArrayList<AppUsageInfo> aList = ScioContext.getAppActivity(context);
// Returns
public class AppUsageInfo {
public String pname; // Application name
public String pkg; // App package name
public long start_time; // unixtime in secs
public long end_time; // unixtime in secs
public double lat; // unused as of 2.5.4
public double lon; // unused as of 2.5.4
}
Location Monitoring Profile
API to set a Location Monitoring profile(LMProfile) for the Location services of the SDK. The LMProfile settings enables developers to change the SDKs' location monitoring algorithm between 4 different options of varying accuracy and battery consumption. The available options and the API are described below
public enum LMProfile {
LM_PROFILE_HIGH, // High sensitivity to location changes with accuracy
LM_PROFILE_OPTIMAL, // Medium sensitivity to location changes with accuracy
LM_PROFILE_LOW, // Medium sensitivity to location changes with low accuracy
LM_PROFILE_SYSTEM // Medium sensitivity to location changes with system default accuracy
}
LMProfile profile = LMProfile.LM_PROFILE_OPTIMAL;
ScioContext.setLMProfile(getActivity(), profile);
LMProfile curProfile = ScioContext.getLMProfile(getActivity().getBaseContext());
Updated about 8 years ago