Seonghwan Seok
Jun 19, 2017
12:19 pm

Find my mobile

Hello

I want to prevent device lock and device unlock by "Find my mobile" web site.

Do you have SDK for prevent device lock and device unlock?

Thank you.

 

Similar topics

No similar topics found.
Samuel V.Samsung SEAP Moderator
Jun 30, 2017
5:29 pm

Hi Seonghwan,

If you're referring to this website: https://findmymobile.samsung.com/, then we don't have an API that directly disables this function. 

But since the website requires the device to have a Samsung account set-up, we have APIs in the Standard SDK that prevent the addition of Samsung accounts and delete Samsung accounts from a device. By calling these two APIs, you're essentially preventing the website from locking or unlocking your device. Note that this does mean that you won't be able to use a Samsung account on your device. 

1) Preventing the addition of a certain account type

 EnterpriseDeviceManager edm = (EnterpriseDeviceManager) getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
 try {
     List<String> blackList = new ArrayList<String>();
     blackList.add(".*@samsung.com");
     blacklist.add(".*@partner.samsung.com"); 
     // Supported account types can be retrieved from getSupoprtedAccountTypes()
     boolean success = edm.getDeviceAccountPolicy().addAccountsToAdditionBlackList("com.samsung", blackList);
     if (success) {
         Log.d(TAG, "Addition to blacklist is a success");
     } else {
         Log.d(TAG, "Addition to blacklist is a failure");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }

2) Deleting accounts of a certain account type

 EnterpriseDeviceManager edm = (EnterpriseDeviceManager) getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
  SecurityPolicy securityPolicy = edm.getSecurityPolicy();
  try {
      boolean result = securityPolicy.removeAccountsByType("com.samsung");
      if(result) {
          //account deleted successfully
      }
  } catch(SecurityException e) {
      Log.w(TAG,"SecurityException: "+e);
  }

Hope it helps.

Best regards,

Samuel