From the course: Android App Development: Enterprise Integration
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Listen for restriction changes: URL - Android Tutorial
From the course: Android App Development: Enterprise Integration
Listen for restriction changes: URL
- [Instructor] Like we did previously in our main activity, we need to listen for changes to our URL. We can do this in the same way. Let's create a new broadcast receiver called restrictionsReceiver, then in our onCreate method, let's define our IntentFilter called restritionsFilter or Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED. Then we will define our broadcast receiver. Then we can copy and paste what we did in onResume to save us some headache, except that we need to make sure that the image update call is done on our UI thread. So let's move this into a new runnable that we post to our image. Don't forget our semicolons. And to finish, scroll down, and still within our activity, Control O for override onDestroy. We should always make sure to unregister our receiver.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Managed application configurations5m 18s
-
(Locked)
Check restrictions: String and bool2m 21s
-
(Locked)
Listen for restriction changes: String and bool2m 19s
-
(Locked)
Check restrictions: URL1m 49s
-
(Locked)
Listen for restriction changes: URL1m 30s
-
(Locked)
App pinning and lock task mode3m 53s
-
(Locked)
-
-