Unable to remember restricted profile settings

I followed http://www.youtube.com/watch?v=pdUcANNm72o and set parameters for my application.

I got 10 boolean elements. This can also be set when in the named profile.

However, they are not checked / do not peel off, and then the owner returns to the settings, they returned to the default.

1 / The system is designed to know which user has which settings are already selected, or I want to check or uncheck the checkbox in GetRestrictionsReceiver. If so, how should I see each user parameter as

Bundle restrictionsBundle = ((UserManager) getSystemService(Context.USER_SERVICE)).getApplicationRestrictions(getPackageName()); restrictionsBundle.getBoolean(".... 

- this is when the user is logged in!

2 / Is this a mistake?

Thanks in advance.

+3
source share
1 answer

Turns out you need to add code when creating RestrictionEntry

Although I will update so that people do not need to hunt ...

In the message of your recipient

  final Bundle oldRestrictions = intent.getBundleExtra(Intent.EXTRA_RESTRICTIONS_BUNDLE); 

then when creating the link to the record.

eg.

 RestrictionEntry myEntry = new RestrictionEntry(KEY, oldRestrictions.getBoolean(KEY, false)); myEntry.setType(RestrictionEntry.TYPE_BOOLEAN); myEntry.setTitle("KEY TITLE"); newEntries.add(myEntry); 
+5
source

Source: https://habr.com/ru/post/950257/


All Articles