2 Answers
We had a similar instances of annoying system dialogs popping up (in the foreground or not) and preventing mobicontrol from processing things when certain settings were changed (location being one). The way I eventually got around it was to disable GMS apps:
com.android.cellbroadcastreceiver
com.android.vending
com.google.android.gms
com.google.android.gm
We are entirely on premise and have no reliance on those apps. I expect most won't have that option.
We don't have system dialogs popping up, i only want to be sure that location data is able to be send, so, i need the setting on all devices.
Is there something like writesecuresettings or so which can handle this?