Skip Navigation

Initialize the
BlackBerry Spark SDK
in your Android app

  1. Import the
    BlackBerry Spark SDK
    into an activity.
    import com.blackberry.security.core.SecurityControl;
  2. Call 
    enableSecurity
    .
    private SecurityControl mSecurity; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initialize BlackBerry Security Library mSecurity = new SecurityControl(this.getApplicationContext()); mSecurity.enableSecurity();
  3. Retrieve the identity token of your authenticated user from your IDP. 
    The ID token is a JSON Web Token (JWT), which is a cryptographically-signed, Base64-encoded JSON object. To retrieve the ID token from your IDP, you must have already authenticated the user.
    If you are using
    Firebase
    , the ID token can be retrieved by following the Firebase instructions to retrieve ID tokens on clients. Other IDPs that are compliant with
    OpenID Connect
    typically provide an endpoint and client library which returns the ID token.
  4. Provide the identity token to the
    BlackBerry Spark SDK
    runtime.
    mSecurity.provideToken(idtoken)
  5. Confirm that the
    InitializationState
    of the runtime is 'active'.
Using the BlackBerry Spark SDK API reference, configure your application to be notified when a threat is detected.