Upgrade from v4.x.x to v5.x.x

HYPR SDK for Android

Update AARs and Gradle

  1. Copy all new libraries that were provided to you into the libs folder.
  2. Update your app/build.gradle file to include the new dependencies.

πŸ“˜

NOTE

Android SDK v5.0.0+ requires a minSdkVersion of 23.

Create HyprDbAdapter Class

The HyprUiAdapter has been replaced in HYPR Android SDK v5.0.0+ by HyprDbAdapter. Modify your HyprUiAdapter sublass to extend HyprDbAdapter. Examples of both files are shown here:

v4.x.x

public class CustomHyprUiAdapter extends HyprUiAdapter {

  @Override
  public void onNewAppProfileCreated(@NonNull Context context) {
    ((CustomDataModel) HyprSetup.getDataModel()).setProfileDefaults(context);
  }
  
}

v5.x.x

public class CustomHyprDbAdapter extends HyprDbAdapter {

  @Override
  public void onNewAppProfileCreated(@NonNull Context context,
 @NonNull HyprAppProfileData appProfileData) {

 appProfileData.setBaseDomainUrl(context, "Place the RP URL here: i.e. https://9999-pov.hypr.com");
    appProfileData.setRpAppId(context, "Relying Party App ID i.e: HYPRDefaultApplication");
   
    // Out of Band Authentication Sets up Firebase with the GCM Sender ID
    appProfileData.setOobEnabled(context, true);
    appProfileData.setPushAppType(context, HyprPushAppType.Firebase);
    appProfileData.setFirebaseGcmSender(context, "GCM Sender ID");
  }

}

Delete the DataModel Subclass

In previous versions of HYPR Android SDK, the DataModel class needed to be extended. This is no longer a requirement for versions 5.0.0+.

  1. All functionality from the DataModel class should be moved to the HyprDbAdapter subclass.
  2. Delete the DataModel subclass.

Update the MultiDexApplication subclass

The initialization of the HYPR SDK has changed in v5.0.0. Since it no longer requires an extended DataModel subclass, it should be removed from the extended MultiDexApplication class. The other changes in initialization can be seen below. Update your MultiDexApplication subclass accordingly.

4.x.x

public class App extends MultiDexApplication {
  
  private static CustomDataModel     sDataModel;
  private static CustomHyprUiAdapter sHyprUiAdapter;

  @Override
  public void onCreate() {
    super.onCreate();
    
    // Out of Band Authentication - Initializes Firebase for Push Notifications
    FirebaseApp.initializeApp(this);

    // HYPR Setup - Initializes the HYPR SDK
    sDataModel = new CustomDataModel(this);
    sHyprUiAdapter = new CustomHyprUiAdapter();
    HyprInit.getInstance().setup();
    HyprSetup.setup(sDataModel, sHyprUiAdapter);

    // HYPR Setup - If a user backgrounds the app during reg/auth/dereg, the operation will be cancelled
    ProcessLifecycleOwner.get().getLifecycle().addObserver(new HyprLifecycleObserver());
    }
}

5.x.x

public class App extends MultiDexApplication {
  
  private static CustomHyprDbAdapter sHyprDbAdapter;
  private static boolean             sIsSetupComplete = false;

  @Override
  public void onCreate() {
    super.onCreate();
    sHyprDbAdapter = new CustomHyprDbAdapter();

    // Out of Band Authentication - Initializes Firebase for Push Notifications
    FirebaseApp.initializeApp(this);
    
    // HYPR Setup - Initializes the HYPR SDK
    HyprInit.getInstance().initTrustData(this, new HyprInit.InitTrustDataCallback() {
      @Override
      public void onInstallComplete() {
        sIsSetupComplete = true;
        Toast.makeText(App.this, "Crypto Initialization Complete", Toast.LENGTH_SHORT).show();
      }

      @Override
      public void onInstallError(@NonNull String error,
                                 @Nullable Throwable throwable) {}
    }, sHyprDbAdapter);
  }
  
  public CustomHyprDbAdapter getHyprDbAdapter() {
    return sHyprDbAdapter;
  }

  public static boolean isSetupComplete() {
    return sIsSetupComplete;
  }
}

Other Changes

Some interface changes were made to make multi-profile easier to use in HYPR Android SDK v5.0.0. Because of these changes, some methods were moved to different places and some actions may need to be kicked off differently. Please refer to the documentation on the following pages to help you finish upgrading: