Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 11. Broadcast Receivers > Adding Custom Permissions to Send and Receive...

11.6. Adding Custom Permissions to Send and Receive Broadcasts

As discussed in Section 6.5.4, an application must be granted permissions to access certain restricted features of the system, such as connecting to the Internet, sending SMS messages, making phone calls, reading the user’s contacts, taking photos, and so on. The user has to grant all or none of the permissions to the application at installation time, and it is the job of the application developer to list all the permissions the app needs by adding the <uses-permission> element to the manifest file. So far, we’ve added permissions to Yamba in order to access the Internet, kick off our boot-time service, and learn about network changes.

But now that we have our Updater service sending a broadcast action to our Timeline receiver, we might want to restrict permission to send and receive that broadcast to our own app. Otherwise, another app, knowing what our action looks like, could send it and cause actions in our application that we didn’t intend.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial