Add code and use APIs to configure AWFramework capabilities in your application.

Retrieve the SDK Profile

Once the SDKContext is in the configured state, you can call the SDKContext getSDKConfiguration() method to retrieve the SDK profile. The SDK must be finished with its configuration otherwise calling getSDKConfiguration() returns with an empty value.

if (sdkContext.getCurrentState() == SDKContext.State.CONFIGURED) {
                  String sdkProfileString = SDKContextManager.getSDKContext().
                  getSDKConfiguration().toString();
                  }
                  
                  
                  
               

Encrypt Custom Data

Once the SDKContext is in the initialized state, you can call the data encryption API set. This set of functions uses the AirWatch SDK's intrinsic key management framework to encrypt and decrypt any data you feed in.

Use the MasterKeyManager API set when the SDK is in an initialized or configured state. See the example of how you can encrypt and decrypt a string value.

if (SDKContextManager.getSDKContext().getCurrentState()!=SDKContext.State.IDLE) {
                  MasterKeyManager masterKeyManager = SDKContextManager.getSDKContext().getKeyManager();
                  String encryptedString = masterKeyManager.encryptAndEncodeString("HelloWorld");
                  String decryptedString = masterKeyManager.decodeAndDecryptString(encryptedString);
                  }
                  
                  
                  
               

Secure Storage Data

After the SDKContext is in the initialized state, you can call the secure storage API set. This set of functions stores key value pairs in encrypted storage.

if (SDKContextManager.getSDKContext().getCurrentState()!=SDKContext.State.IDLE) {
                  SecurePreferences pref = SDKContextManager.getSDKContext().getSDKSecurePreferences();
                  pref.edit().putString(<KEY_NAME>, <VALUE>).commit(); // to store value
                  Object value = pref.getString(<KEY_NAME>, <Default_Value>);
                  }