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
- Container account blacklist and whitelist
- Is it standard behavior that changes are reverted when device admin is removed? Is there any way to change this behavior?
- Remove device admin and uninstall app silently
- App installation and factory reset locked
- Disable youtube and airplane mode