Latest Android Enterprise Agent is not enrolling properly for newer Samsung Devices.

Latest Android Enterprise Agent is not enrolling properly for newer Samsung Devices.



Samsung Device OEM Version QP1A.190711.020.A505FNXXS5BTJ4


Samsung devices updated to the latest firmware are returning a Device APIiD of 840. This value is missing from the database table [MobiControlDB].[dbo].[AndroidDeviceAPILkUp]

Which leads to the following error in the logs.

2020-11-17 18:02:03,527 (0x00000ae0) [ERROR] System.Data.SqlClient.SqlException (0x80131904): The MERGE statement conflicted with the FOREIGN KEY constraint "FK_AndroidDeviceAPI_APIId". The conflict occurred in database "MobiControlDB", table "dbo.AndroidDeviceAPILkUp", column 'APIId'.
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Soti.MobiControl.Platforms.Android.Devices.DeviceApi.Providers.Implementation.AndroidDeviceAPIDataProvider.AndroidDeviceAPI_Merge_ByDeviceIds(ICollection`1 deviceAPIDatas)
   at Soti.MobiControl.Platforms.Android.Devices.SupportedApisUpdateHandler.Handle(Int32 deviceId, IEnumerable`1 supportedApis)
   at CSOTIDatabase.UpdateDeviceDSE(CSOTIDatabase* , CDBDevice* device, Boolean aUpdateCustomData)
Error Number:547,State:0,Class:16

This error is preventing those devices from enrolling completely. As this was urgent I had a guess at what should be in that table and came up with the following.

APIId = 840

Description = MCW.enums.DeviceAPI.SamsungKnoxV34

APIName = SamsungKnoxV34


The change works in so far as the devices will now enroll but does not display the proper API name in the web console.

Is there a script that needs to be run to add these new API levels to the database properly?


 N.B This appears to be the same issue as

5 Answers

Order By:   Standard | Newest | Votes
JCMOD@SOTI | posted this 19 November 2020

Hi Will,


Thank you for posting in SOTI Central.


As a word of caution, you shouldn't be modifying your database in this manner as that potentially voids your Support for future issues. I recommend you revert back the change and utilize the workaround found within your linked discussion. You're correct in that the problem originates due to an API issue on the 14.4.1 agent. And that is through the new 840 APIID for Samsung KNOX 3.4.


I suggest that you raise a Support Case so that you can be kept informed on the progression of the fix. Or alternatively, I will endeavor to update the linked post when possible.



Technical Support | SOTI Inc. |1.905.624.9828 | | |

  • 1
  • 1
Rémi | posted this 27 November 2020

We have the same problems on our side, we use the KME for enrollment of our Samsung devices.
We have had to revert to version for the moment.
I hope SOTI will provide a new version of agent that fixes this.


  • 0
  • 0
Marek M | posted this 30 November 2020


I just want to add that I found another issue with this agent, this time with custom data

Problematic mobiles:

Samsung with Android 10 and agent ver.

Custom data:

Is working in relocation rule;

Are not visible in device detail;

Are not working anymore with our scripts for changing background and changing name.

Everything works fine with older agent or Nokia mobiles or OS versions.

  • 0
  • 0
Raymond Chan | posted this 30 November 2020

The v14.4.1.1064 AE device agent doesn't seem to have any problem with MobiControl  v14.5.3 or v14.5.5 server in my tests, but do have some problems on the same Samsung test device when enrolled onto a v15.2.x server.  

  • 0
  • 0
Rémi | posted this 08 December 2020


I tested an enrollment with the new version published today we have no more problem with installation of profiles AE.


  • 1
  • 0

Give us your feedback
Give us your feedback