• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
BlackberryAnalytics Class Reference

Class for BlackBerry Analytics and BlackBerry Persona. More...

Description

BlackBerry Analytics

BlackBerry Analytics provides developers and UEM administrators metrics about the BlackBerry Dynamics apps and devices in an organization's environment. BlackBerry Dynamics apps with this feature enabled by their administrator will periodically send events (including startup, crash information) and data (including OS, minutes used, app name, version) to the BlackBerry Analytics platform. The BlackBerry Analytics platform processes and compiles the events and data into dashboard reports. An app developer can optionally use this programmatic interface to record usage of custom features or events within their app to enable these metrics to be included within the Analytics dashboard.

For more information, see the BlackBerry Analytics documentation.

BlackBerry Persona

BlackBerry Persona processes events and location data from BlackBerry Dynamics apps to assess a user’s security risk level based on their real-world context, and adjusts the user’s device and app behavior based on their current risk level. For example, if a user’s app data reports a geographic location that is not typical for the user, BlackBerry Persona can dynamically limit the user’s access to work apps or disable certain device features such as the camera. In addition, it can be configured by the enterprise administrator to enforce stricter authentication requirements by applying an override policy.

This service requires enabling and configuration by the enterprise administrator. In addition, application developers are required to perform steps to enable BlackBerry Persona.

Enabling BlackBerry Persona

Implement these step to enable Persona within a BlackBerry Dynamics application.

1. Create a com.blackberry.dynamics.settings.json file in the assets/ folder of the application. In this file include the following:

{
"EnableBlackBerryPersona": true
}

2. Add a setting in the application user interface for end users to enable or disable BlackBerry Persona.

This setting should ideally be implemented within the 'Settings' or 'Preferences' section of your application's user interface. When the user selects a menu item called 'BlackBerry Persona Settings' the application should call the method BlackberryAnalytics.displaySISsettings. This triggers the runtime to display a settings screen which provides the user the option to opt in or out of using location based information when assessing their current risk level. This is a legal requirement to ensure end users are able to opt out of location data collection at any time. It is best practice to only show this option to users who have BlackBerry Persona enabled by their administrator, see BlackberryAnalytics.isSISenabled.

For more information, see the BlackBerry Persona documentation.

Static Public Member Functions

static synchronized AnalyticsResponse trackFeatureEvent (final AnalyticsEvent eventType, final String featureName)
 Record feature events to analyse the period a specific app feature is used. More...
 
static synchronized AnalyticsResponse trackApplicationEvent (AnalyticsEvent eventType, String eventValue, String eventKey)
 Record adoption events to analyse the frequency of specific user actions or events. More...
 
static synchronized void trackSecurityEvent (final SecurityEventType eventType, final String eventVal)
 Register a security event which will trigger BlackBerry Persona risk analysis. More...
 
static synchronized AnalyticsResponse trackAppUsagePattern (final AppUsageEventType appUsageEventType, final int version, final JSONObject appData)
 Track App Usage events to detect anomalies in user behaviour. More...
 
static synchronized void displaySISsettings ()
 Show a settings screen to enable the user to manage BlackBerrry Persona. More...
 
static synchronized boolean isSISenabled ()
 Determine if BlackBerry Persona is enabled for the current user by their administrator. More...
 

Member Function Documentation

◆ trackFeatureEvent()

static synchronized AnalyticsResponse trackFeatureEvent ( final AnalyticsEvent  eventType,
final String  featureName 
)
static

Call to record an event that has a start point (a "feature active event") followed by a stop point (a "feature inactive event"). The start and stop points provide a period of time where the feature was active. This type of event is typically used to measure user engagement of app features. The name that is used to track a feature must be unique within the app.

Parameters
eventTypeAnalyticsEvent specifies the type of event. For example, FEATURE_ACTIVE or FEATURE_INACTIVE.
featureNameString containing the name of the feature for a given event.
Returns
AnalyticsResponse will return RECORD_SUCCESS if event is valid or a specific error otherwise.

◆ trackApplicationEvent()

static synchronized AnalyticsResponse trackApplicationEvent ( AnalyticsEvent  eventType,
String  eventValue,
String  eventKey 
)
static

Call to record an event which occurs in your application. An adoption event has two attributes, key and value. The key must be unique within the app, and the value is a count of the number of times a specific event occurs (for example, an event key called "Emails deleted" that tracks the number of emails deleted by a user). The adoption event value should be the string representation of the integer count. An app can combine events and record a single event.

Parameters
eventTypeAnalyticsEvent specifies the type of event. In this case use ADOPTION_EVENT.
eventValueString containing the event value to record for the given event key.
eventKeyString to define the name of the event.
Returns
AnalyticsResponse will return RECORD_SUCCESS if event is valid or a specific error otherwise.

◆ trackSecurityEvent()

static synchronized void trackSecurityEvent ( final SecurityEventType  eventType,
final String  eventVal 
)
static

BlackBerry Persona risk analysis is performed by default when an application is brought to the foreground. To trigger risk analysis at other points in your application life-cycle, use this method to register the appropriate events. For example, your application could trigger risk analysis if a file is shared, money is transferred, or data is deleted.

Call this method setting the eventVal to correspond with the specific application event which should trigger risk analysis, e.g. 'SHARE_FILE'. Set SecurityEventType to SECURITY_ADOPTION_EVENT or other appropriate SecurityEventType. After you've successfully registered the security event, all subsequent calls, in this example, to trackApplicationEvent with the eventKey of 'SHARE_FILE' will trigger BlackBerry Persona risk analysis.

Parameters
eventTypeSecurityEventType specifies which event type.
eventValString containing the event value to record for the given event key.

◆ trackAppUsagePattern()

static synchronized AnalyticsResponse trackAppUsagePattern ( final AppUsageEventType  appUsageEventType,
final int  version,
final JSONObject  appData 
)
static

BlackBerry Persona can perform enhanced risk analysis and continuous authentication by tracking anomalies in user behavior. The risk engine can detect a user's anomalous app usage behavior and enforce user identity either by requiring a user to re-authenticate to confirm their identity, or by applying predefined policy.

Parameters
appUsageEventTypeAppUsageEventType should be set to CONTINUOUS_AUTH.
versionint containing the current version of the API. Should be set to 1.0
appDataJSONObject of app usage events.
Returns
AnalyticsResponse will return RECORD_SUCCESS if event is valid or a specific error otherwise.

To instrument user actions in your application, construct the following information to send within appData:

JSON Schema

The following schema applies to the payload sent within appData

appData:
type: object
description: Record data for model generation and scoring based on app usage
required:
- module
- moduleVersion
- eventTs
- eventType
properties:
module:
type: string
description: App feature/module which the event corresponds to.
example: 'email'
moduleVersion:
type: string
description: Schema version of the payload. This version along with the application identifier is used by BlackBerry Persona service to process the payload.
example: '1.0'
eventTs:
type: integer
format: int64
description: Time-stamp of the event expressed as an epoch.
example: 994953488910
eventType:
type: string
description: The type of custom action performed by the user within a module.
example: 'SHARE'
event:
description: Optional object to include additional details related to an event. For example a search string or attributes of a file being shared.
type: object
additionalProperties:
description: Event specific fields (object type is a map)
type: object

Module

If your application contains disparate capabilities, subdivide these into modules, e.g. payments, email, editor.

EventType

Identify a set of custom eventTypes which correspond to specific user actions within each module. The following are examples of events that you may wish to track.

  • COPY
  • DELETE
  • FORWARD
  • DOWNLOAD
  • OPEN_IN
  • REPLY
  • SCREEN_SHOT
  • SCROLL_DOWN
  • SCROLL_UP
  • SEARCH
  • SEND
  • SHARE
  • SWIPE_LEFT
  • SWIPE_RIGHT

Example Payload

The following is an example of JSON payload for appData.

{
"eventType": "SWIPE_RIGHT",
"module": "email",
"moduleVersion": "1.0",
"eventTs": 1580938248291
},
{
"eventType": "DELETE",
"module": "filemanager",
"moduleVersion": "1.0",
"eventTs": 1580938248705
}

◆ displaySISsettings()

static synchronized void displaySISsettings ( )
static

Show a settings screen to enable the user to manage BlackBerrry Persona. The settings screen provides the user the option to opt in or out of using location based information when assessing their current risk level. The settings can only be changed if BlackBerry Persona is enabled for the user by the administrator. See BlackBerryAnalytics.isSISenabled below.

◆ isSISenabled()

static synchronized boolean isSISenabled ( )
static

Call this method to determine if BlackBerry Persona is enabled for the current user. For help see 'Steps to configure and use BlackBerry Persona' within the BlackBerry Persona documentation.

Returns
true if BlackBerry Persona has been enabled for this user by their administrator.
false otherwise.