34,333
edits
Changes
→Creating the Broadcast Receiver
This concludes the creation of the application to send the broadcast intent. All that remains is to build a matching broadcast receiver.
== Creating Creating the Broadcast Receiver ==
In order to create the broadcast receiver, a new class needs to be created which subclasses the BroadcastReceiver superclass. Within the Project tool window, navigate to app -> java and right-click on the package name. From the resulting menu, select the New -> Other -> Broadcast Receiver menu option, name the class MyReceiver and make sure the Exported and Enabled options are selected. These settings allow the Android system to launch the receiver when needed and ensure that the class can receive messages sent by other applications on the device. With the class configured, click on Finish.
override fun onReceive(context: Context, intent: Intent) {
throw UnsupportedOperationException("Not yet implemented")