Forum Discussion
Managed configurations is null while creating work-profile
Hey Shivam.,
How's it going?
Mr. jasonbayton , I wanted to loop you in to see if you have any insights or responses to this question. 😊
Thanks,
Reece
As of now, I am not able to pin-point the issue and still looking for some insight on the issue to resolve it.
I have uploaded the policy and bugreport of the a device that is enrolling in the work-profile without issue (Samsung) and of the particular device that is having the issue (Moto).
https://drive.google.com/drive/folders/1-iOVMhbCV5fC23yXIvyXB341eOqLJAoZ?usp=sharing
I used the same policy in both of the devices and in fully managed, along with the work-profile where we allow personal usage. Everywhere the policy works but in two of our new moto devices giving us the issue as I have explained in the post.
Here is the code that we use in the MainActivity of the app when it opens up to get the Restrictions.
fun setupRestrictions(){
val restrictionManager = getSystemService(Context.RESTRICTIONS_SERVICE) as RestrictionsManager
val appRestrictions = restrictionManager.applicationRestrictions
if (appRestrictions != null){
val id = appRestrictions.getString(AppDataStoreKey.id.key)
val url = appRestrictions.getString(AppDataStoreKey.url.key)
Log.d(TAG, "onCreate: Restrictions: ${Gson().toJson(appRestrictions)}")
if (!id.isNullOrEmpty()){
CoroutineScope(Dispatchers.IO).launch {
appDataStore.saveString(AppDataStoreKey.id, id)
}
}
if (!url.isNullOrEmpty()){
CoroutineScope(Dispatchers.IO).launch {
appDataStore.saveString(AppDataStoreKey.url, url)
}
}
Log.d(TAG, "onCreate: Restrictions: \nID: $id \nURL: $url")
}
}
Related Content
- 2 years ago
- 2 years ago