Menu

Update your app

This section shows you the steps required migrate the app in Android Studio.

Import the new libraries

  1. In the folder where you downloaded the Samsung Knox SDK, go to the libs folder and copy the two new JAR files:


    Note: If you are a VPN provider, looking to migrate your solution to Knox 3.4 or above, see VPN namespace changes.

  2. In your IDE, add the JAR files. In Android Studio, you right-click the libs folder and click Paste.
  1. Delete the old Knox JAR files from your project.

  2. Edit build.gradle to prevent Android Studio from including the JAR files during compile and run-time:


  3. Edit build.gradle to remove references to the old JAR files.
  1. Edit the build.gradle file to include supportlib.jar at run-time and knoxsdk.jar at compile-time:


  2. Delete the corresponding XML files from your project.

Update the package names

  1. After trying a build, the IDE will highlight unresolved packages that were in the deleted JAR files. Find these.
  2. Replace old package names with the new ones. To find the new name, use any of these methods:
  • Use your IDE’s quick fix feature. In Android Studio, delete all the import statements for the old Samsung Knox packages. Then highlight an unresolved class name and press [Alt] + [Enter] (for Windows/Linux) or [Option] + [Enter] (for Mac) to add its required import statement.

  • If that doesn’t work, use your IDE’s find class feature. In Android Studio, select the class name and press [Ctrl]-[n] (for Windows/Linux) or [Command]-[o] (for Mac) to see its new package name:

To find new namespace, you can also:

  • Enter the class name in the API Reference Search tool, which shows the class' full package name.
  • Look up the new package name in the API Reference Package index
  • Check the list of new package names for the API class

Update the class names

In a few cases, the package name cannot be resolved because the class name has changed with the new Samsung Knox SDK, for better clarity or consistency:

Old Package

Old Class

New Package

New Class

android.app.enterprise

Attestation

com.samsung.android.knox.integrity

AttestationPolicy

android.app.enterprise

MiscPolicy

com.samsung.android.knox.xxx

BrowserPolicy, and so on.

android.app.enterprise.devicesettings

DeviceSettingsPolicy

com.samsung.android.knox.net

GlobalProxy

android.app.enterprise.devicesettings

DeviceSettingsPolicy

com.samsung.android.knox.nfc

NfcPolicy

android.app.enterprise.lso

SecurityPolicy

com.samsung.android.knox.lockscreen

BootBanner

android.app.enterprise.SecurityPolicy

SecurityPolicy

com.samsung.android.knox.keystore

CertificateProvisioning

com.sec.enterprise.knox.seams

SEAMS

com.samsung.android.knox.seams

SEAMSPolicy

In these cases, look up the API method name in the new Knox SDK API reference and update its class name as well as the package name.

Update the API method names

A few API methods were also renamed for better clarity and consistency. Update these names as well.

Old Package

Old Class

Old Method

New Package

New Class

New Method

android.app.enterprise.multiuser

MultiUserManager

getInstance

com.samsung.android.knox

EnterpriseDeviceManager

getMultiUserManager

com.sec.enterprise.knoxauditlog

AuditLog

getInstance

com.samsung.android.knox

KnoxContainermanager

getAuditLogPolicy

android.app.enterprise.geofencing

Geofencing

getInstance

com.samsung.android.knox

EnterpriseDeviceManager

getGeofencing

android.app.enterprise.devicesettings

DeviceSettingsPolicy

getInstance

com.samsung.android.knox

EnterpriseDeviceManager

getGlobalProxy

android.app.enterprise.kioskmode

KioskMode

getInstance

com.samsung.android.knox

EnterpriseDeviceManager

getKioskMode

android.app.enterprise.lso

LockscreenOverlay

getInstance

com.samsung.android.knox

EnterpriseDeviceManager

getLockscreenOverlay

android.app.enterprise.devicesettings

DeviceSettingsPolicy

getInstance

com.samsung.android.knox

EnterpriseDeviceManager

getNfcPolicy

android.app.enterprise.remotecontrol

RemoteInjection

getInstance

com.samsung.android.knox

EnterpriseDeviceManager

getRemoteInjection

Update the permissions

Permissions allow you to specify what Knox SDK features your app can access.


If you have...

You need to declare permissions in your app, to specify which Knox APIs your app can access.


Here's how:
  1. Log in to the Knox Partner Portal > Dashboard to see which licenses you have.
  2. Review the permissions granted by your licenses.
  3. Declare the permissions you need in your AndroidManifest.xml file.

    Example:

    <?xml version-"1.0" encoding-"utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.samsung.knoxsdksample">
    <!-- Declare the Knox permissions used by this app -->
    
    <uses-permission android:name="com.samsung.android.knox.permission.KNOX_HW_CONTROL"/>
    <uses-permission android:name="com.samsung.android.knox.permission.CUSTOM_SETTING"/>
    
    <!-- Declare the Android permissions used by this app -->
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    
    <application
    ...
    <!-- Enable selective Knox permissions -->
    <meta-data android:name="com.samsung.knoxlicense.permissions" android:value="true">
    ...
    </application>
    </manifest>			

If you are using the old namespace, you need to change your permissions to use the new namespaces for permissions. If you are already using the new namespace, you do not need to make any changes.


Example of how to change the namespace:
  • Permission with the old namespace: android.permission.sec.ENTERPRISE_DEVICE_ADMIN
  • Permission with the new namespace: com.samsung.android.knox.permission.KNOX_ENTERPRISE_DEVICE_ADMIN

Tutorial Progress

You are 3/4 done! Go to the next step.

Share it: