Is there any API to check whether device is KNOX supported or not?

PJ

I have an KNOX enabled application. Now, I want that if application is running on KNOX supported devices then app should go for activation of licenses and creation of kiosk mode. But if application is running on other devices, which are not having built in support for KNOX. Then there can be two posibilities: 

1. Is there any way to or workaround through which we can support KNOX features on those devices?

2. Is there any API which will check that, whether the running device is KNOX enabled or not? On the basis of that value we can bypass the license activation and other flow.

Please suggest.

Thanks.

4 Replies

pj

Hi Kieran,

 

I tried the above solution. But I'm getting NullPointerException on below line when run on non-samsung device.

edm.getEnterpriseSdkVer();

So, here we can put a null check to differentiate between Samsung and non-samsung device. 

so the overall code is:

 try {
                 EnterpriseDeviceManager edm = 
                           (EnterpriseDeviceManager)getSystemService
                           (EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
                 if(edm != null){
                     ver = edm.getEnterpriseSdkVer();
                     KnoxUtilities knoxUtilities = KnoxUtilities.getInstance();
                     knoxUtilities.activateAdmin(context);
                 }else{
                     // TODO:
                 }
         } catch (NoSuchMethodError e){

         } catch (NoClassDefFoundError e){
             
         }

I ran this code on Samsung device with android version 4.1.2, without Knox Support. While activating ELM license,I'm getting an exception with error message "Stub!". 

So, is there any other API to check whether running Samsung device is Knox Supported or not?

KM

Hi Prachi,

That is very strange, can you please provide me with the build number of the device?

 

pj

Hi Kieran,

Following are the details:

Build Number: JZ054K.P3100DDCNA3

Model Number: GT-P3100

Android version: 4.1.2

Prachi, getEnterpriseSdkVer() is supported only since SDK Version 2!

Older SDK versions seem to have code like that:

public EnterpriseDeviceManager.EnterpriseSdkVersion getEnterpriseSdkVer() { throw new RuntimeException("Stub!"); }

 

So put a try/catch block around getEnterpriseSdkVer and you can distinguish between SDK <2.0 and SDK >=2.0. 

For versions SDK >=2.0 getEnterpriseSdkVer will work subsequently.

Similar topics

No similar topics found.