From the course: Android App Development: Enterprise Integration

Unlock the full course today

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

Listen for restriction changes: URL

Listen for restriction changes: URL - Android Tutorial

From the course: Android App Development: Enterprise Integration

Start my 1-month free trial

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.

Contents