Nuclei SDK Intialisation
Initialisation
Nuclei SDK should be initialised before using any feature of the SDK. Initialisation should happen in onCreate() method of your application class - this ensures the Nuclei SDK gets initialised when the user opens the application.
Please follow these steps:
- 
Your Application class should extend the
MultiDexApplicationclass. In case you have a super Application class which you have already extended, then refer Enable multidex for apps - 
Create a private instance of NucleiSDK and expose it using a public getter.
 - 
Inside the onCreate() method of your application class initialise the Nuclei SDK.
 - 
Replace
<NUCLEI-SDK-KEY>with the actual key you received from Nuclei. 
public class Application extends MultiDexApplication {
   private NucleiSDK nucleiSDK;
   @Override
   public void onCreate() {
       super.onCreate();
       initNuclei();
   }
   public NucleiSDK getNucleiSDK() {
       return nucleiSDK;
   }
   void initNuclei() {
       nucleiSDK = NucleiSDK.bind(this)
                // Pass the environment directly (refer to below table)
               .setEnvironment(SdkEnvironment.STAGING) 
               .setKey("<NUCLEI-SDK-KEY>")
               .setTheme(R.style.SampleSdkTheme) 
               .init();
// Notes:
// 1. SampleSdkTheme is same as defined in Step 2 above
// 2. You can set the environment at runtime using build flavour. eg.          
// BuildConfig.FLAVOR.equals("production")
//                 ? SdkEnvironment.INDIA_PRODUCTION
//                 : SdkEnvironment.STAGING
   }
}
Setting the Environment
The setEnvironment() method determines which environment your SDK will connect to. You must choose one of the following environments:
| Environment | Purpose / Notes | 
|---|---|
SdkEnvironment.STAGING | Preproduction / UAT testing | 
SdkEnvironment.INDIA_PRODUCTION | Use for CUG and Production releases in India | 
SdkEnvironment.UAE_PRODUCTION | Use for Production releases in UAE |