From the course: Android App Development: Enterprise Integration

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Check restrictions: String and bool

Check restrictions: String and bool - Android Tutorial

From the course: Android App Development: Enterprise Integration

Start my 1-month free trial

Check restrictions: String and bool

- [Instructor] Once we have manage configurations defined, we need to set up our app to check the values of these configurations when it starts or resumes, and when they are changed. In our example applications MainActivity, we need to start by defining a RestrictionsManager object. And I'm going to call this myRestrictionsManager. In the onCreate method, let's define our restrictions manager object by getting the system service, with the parameter being Context.RESTRICTIONS_SERVICE. Make sure we cast this as a restrictions manager. Now that we have our service, in our onResume method, we can get a bundle of application restrictions by calling getApplicationRestrictions from the restrictions manager. We can now access any configured application restrictions using the keys we defined earlier. Please keep in mind that the application restrictions bundle will be empty if the application is not being managed by a mobile device management system. For this reason, we should always start by…

Contents