emailAccountPolicy.getAllEmailAccounts() returns null
I am using the KNOX Standard SDK to retrieve all email accounts and delete a specific one from the list. I have followed the tutorial to activate the license and my app does activate (I checked via the EnterpriseLicenseManager.ACTION_LICENSE_STATUS lntent). But for some reason the emailAccountPolicy.getAllEmailAccounts() produces null even though there are email accounts on the device.
Here is the code I used with the KNOX APIs
EnterpriseDeviceManager edm = (EnterpriseDeviceManager) getSystemService(EnterpriseDeviceManager.ENTERPRISE_POLICY_SERVICE);
EmailAccountPolicy emailAccountPolicy = edm.getEmailAccountPolicy();
Account accounts = emailAccountPolicy.getAllEmailAccounts();
I was able to retrieve the accounts via the native Android API. here is the code I used
AccountManager accMgr = AccountManager.get(CTMobileApplication.getContext()); Account accounts = accMgr.getAccounts();
- Retrieve EmailAcount infomation from device
- Unable to black list email account
- Blacklist Accounts
- Is it standard behavior that changes are reverted when device admin is removed? Is there any way to change this behavior?
- Blacklisting a Wi-Fi network in the device's EnterpriseDeviceManager but enabling access to it within the container
- allowOpenWifiAp(true); is not working