{"id":81540,"date":"2021-06-28T09:00:59","date_gmt":"2021-06-28T03:30:59","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=81540"},"modified":"2024-08-02T19:45:47","modified_gmt":"2024-08-02T14:15:47","slug":"android-broadcast-receivers","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/","title":{"rendered":"Android Broadcast Receivers"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">This article will help you understand what a broadcast receiver is and why it is used in Android Development. First, you will know the various types of Broadcast Receivers. Further, you will notice the system-generated intents and how they are implemented.\u00a0<\/span><\/p>\n<p>Let&#8217;s start!!!<\/p>\n<h2>What are Broadcast Receivers in Android?<\/h2>\n<p><span style=\"font-weight: 400;\">Broadcast Receivers\u2019 task is to <\/span><b>receive any kind of intents<\/b><span style=\"font-weight: 400;\"> from other applications. They respond to such intents with some behavior. Usually, broadcast receivers help to notify users of any process or application. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">They can notify the user either through notification, status bar, or even through the user\u2019s application(if active).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It\u2019s not always necessary for your applications to be active to receive some notifications. Most of the time, these broadcasts are system originated and <\/span><span style=\"font-weight: 400;\">don\u2019t<\/span><span style=\"font-weight: 400;\"> require the app\u2019s user interface.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The most <\/span><b>common example is your alarm application<\/b><span style=\"font-weight: 400;\">. Whenever you keep an alarm, you leave that application or simple terms, close that application. Still, at that particular time, you receive the ring of your alarm.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Another pervasive example <\/span><b>is your low battery reminders<\/b><span style=\"font-weight: 400;\">. Whenever your device has insufficient charge left, your device notifies you to keep charge or on battery saver mode.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">These all happen because of the presence of broadcast receivers. It helps the system and the user\u2019s applications to communicate.<\/span><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Android_Broadcast_Receivers-normal-image.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81542\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Android_Broadcast_Receivers-normal-image.jpg\" alt=\"Android Broadcast Receiver\" width=\"1094\" height=\"565\" \/><\/a><\/p>\n<h2>Types of Broadcast Receiver in Android<\/h2>\n<p><span style=\"font-weight: 400;\">Broadcast Receivers can be classified into two types:<\/span><\/p>\n<h3>1. Static Broadcast Receivers<\/h3>\n<p><span style=\"font-weight: 400;\">All the declarations of static broadcast receivers are present in the manifest file. These broadcasts work both when the app is active and even if the app is inactive or closed. Static broadcast receivers are registered at the time of app installation and can respond to system-wide broadcast intents, such as boot completed or network changes. They are useful for handling events even when the app is not running, ensuring the app can respond to critical system-wide events.<br \/>\n<\/span><\/p>\n<h3>2. Dynamic Broadcast Receivers<\/h3>\n<p><span style=\"font-weight: 400;\">Dynamic Broadcast receivers run only when the app is running. If the app is closed, then you won\u2019t be able to have any dynamic broadcast receivers. These receivers are registered in the code, typically in an activity or service, and they are unregistered when the app is no longer running. Dynamic receivers provide more flexibility and control, as they can be registered or unregistered based on specific conditions within the app, and they help conserve system resources by only being active when necessary.<\/span><\/p>\n<h2>Classes of Broadcast Receivers<\/h2>\n<p><span style=\"font-weight: 400;\">Broadcast receivers can be divided into two subclasses:<\/span><\/p>\n<h3>1. Ordered Broadcast Receiver in Android<\/h3>\n<p><span style=\"font-weight: 400;\">Ordered broadcasts are ordered and synchronous. The broadcast that has the highest priority is executed first and then the others. If two broadcasts have the same priority, then they won\u2019t follow any order.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You can assign priority to the broadcast by using the <\/span><b>android: priority<\/b><span style=\"font-weight: 400;\"> attribute.<\/span><\/p>\n<h3><b>2. Normal Broadcast Receiver in Android<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Normal broadcasts are unordered and asynchronous. The broadcasts don\u2019t have any priority and follow a random order. You can run all the broadcasts together at once or run each of them randomly. These broadcasts are sent by using the <\/span><b>Context:sendBroadcast.<\/b><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To understand the above two, you can see the below example.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Usually, you get notifications from most applications. These notifications are customizable. You can set priority to these notifications. A notification with higher priority will come with a tone and will also occupy the system notification tray.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The notifications which have low priority may not give you a tone or vibration. You can even mute notifications of applications.\u00a0<\/span><\/p>\n<h2>System Generated Intents in Android<\/h2>\n<p><span style=\"font-weight: 400;\">The system generates several intents to show various system events. Some of them are described below:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<h4><b>SL No<\/b><\/h4>\n<\/td>\n<td>\n<h4><b>Intent Name<\/b><\/h4>\n<\/td>\n<td>\n<h4><b>Description<\/b><\/h4>\n<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>android.intent.action.CALL<\/td>\n<td>It helps to call the person whose data is mentioned in the data provided to the intent.<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>android.intent.action.BOOT_COMPLETED<\/td>\n<td>It is displayed when the device boots up successfully.<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>android.intent.action.BATTERY_LOW<\/td>\n<td>This is used to notify the user that his device battery is pretty low.<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>android.intent.action.BATTERY_CHANGED<\/td>\n<td>It notifies the user whenever there is a change in the state of the battery of the device.<br \/>\nFor example, Charging or battery level changing, etc.<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>android.intent.action.DATE_CHANGED<\/td>\n<td>It updates the user that his device date has changed to some other day.<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>android.intent.action.BUG_REPORT<\/td>\n<td>This is used to notify the user if some bugs have occurred while executing a task.<\/td>\n<\/tr>\n<tr>\n<td>7<\/td>\n<td>android.intent.action.POWER_CONNECTED<\/td>\n<td>It makes the user aware that his device has connected to charge.<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>android.intent.action.POWER_DISCONNECTED<\/td>\n<td>It indicates to the user that his device has got disconnected from the power supply.<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>android.intent.action.CONNECTIVITY_CHANGE<\/td>\n<td>This indicated to the user that his device connectivity has changed.<br \/>\nFor example, The user has shifted from the cellular network to a WIFI.<\/td>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>android.intent.ACTION_AIRPLANE_MODE_CHANGED<\/td>\n<td>It notifies the user if the airplane mode is turned on or off.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Custom Intents in Android<\/h2>\n<p><span style=\"font-weight: 400;\">Apart from the system-generated intents, you can also generate custom intent using the sendBroadcast() method. This allows our application to create intent by itself.\u00a0<\/span><span style=\"font-weight: 400;\">You can achieve it by creating your Receiver class and sending broadcasts to that receiver class from your main activity.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To send a broadcast you can use the sendBroadcast() method in your activity class.\u00a0<\/span><\/p>\n<h2>Implementation of Broadcast Receivers in Android<\/h2>\n<p><span style=\"font-weight: 400;\">To make our app interactive we need to handle the broadcast receivers nicely.\u00a0 <\/span><span style=\"font-weight: 400;\">There are two ways to implement broadcast receivers that are as follows:<\/span><\/p>\n<h3>1. Context-Registered<\/h3>\n<p><span style=\"font-weight: 400;\">This method is used to register a broadcast receiver dynamically. This is done using the registerReceiver() method.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Below is an example of the same.\u00a0<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">registerReceiver(batteryBroadcastReceiver, IntentFilter(Intent.ACTION_BATTERY_CHANG\r\n<\/pre>\n<h3><b>2. Manifest-Registered<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Using this method, you can register your broadcast receivers in your manifest file. For this, you require to use the &lt;receiver&gt; tag in the manifest file.<\/span><span style=\"font-weight: 400;\">Below is an example of the same.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;receiver android:name=\"TehhVidvanReceiver\" &gt;\r\n             &lt;intent-filter&gt;\r\n                 &lt;action android:name=\"android.intent.action.BATTERY_CHANGED\" \/&gt;\r\n             &lt;\/intent-filter&gt;\r\n&lt;\/receiver&gt;\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">Following are the steps using which you can implement broadcast receivers in Android. We will show you how to create a <\/span><span style=\"font-weight: 400;\">battery <\/span><span style=\"font-weight: 400;\">level indicator application that displays your device\u2019s battery current level.\u00a0<\/span><\/p>\n<p><b>1<\/b><span style=\"font-weight: 400;\">: Open your Android Studio.<\/span><\/p>\n<p><b>2<\/b><span style=\"font-weight: 400;\">: Click on Create New Project.<\/span><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Broadcast_App_Demo1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81543\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Broadcast_App_Demo1.png\" alt=\"Create Android Project\" width=\"1852\" height=\"1048\" \/><\/a><\/p>\n<p><b>3<\/b><span style=\"font-weight: 400;\">: Select Empty Activity and proceed.<\/span><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Broadcast_App_Demo2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81544\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Broadcast_App_Demo2.png\" alt=\"Android Activity\" width=\"1848\" height=\"1048\" \/><\/a><\/p>\n<p><b>4:<\/b><span style=\"font-weight: 400;\"> Enter your application name. In my case, it\u2019s \u201cTechVidvanBroadcast.\u201d Next, select Kotlin from the dropdown. For the API level, select API 22 for now.<\/span><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Broadcast_App_Demo3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81545\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Broadcast_App_Demo3.png\" alt=\"Android API\" width=\"1852\" height=\"1048\" \/><\/a><\/p>\n<p><b>5<\/b><span style=\"font-weight: 400;\">: Now go to the app &#8211;&gt; res &#8211;&gt; layout &#8211;&gt; activity_main.xml and add a text view to display the battery level. You can copy the <\/span><b>activity_main.xml<\/b><span style=\"font-weight: 400;\"> code from below<\/span><\/p>\n<p><strong>Code: (activity_main.xml)<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;androidx.constraintlayout.widget.ConstraintLayout\r\n    xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\r\n    xmlns:tools=\"http:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    tools:context=\".MainActivity\"&gt;\r\n\r\n    &lt;TextView\r\n        android:id=\"@+id\/title\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"TechVidvan\"\r\n        android:textColor=\"@color\/teal_700\"\r\n        android:textStyle=\"bold\"\r\n        android:textSize=\"35sp\"\r\n        app:layout_constraintVertical_bias=\".1\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintLeft_toLeftOf=\"parent\"\r\n        app:layout_constraintRight_toRightOf=\"parent\"\r\n        app:layout_constraintTop_toTopOf=\"parent\" \/&gt;\r\n\r\n    &lt;TextView\r\n        android:id=\"@+id\/level_title\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"Your battery level is\"\r\n        android:textColor=\"@color\/black\"\r\n        android:textSize=\"25sp\"\r\n        app:layout_constraintVertical_bias=\".4\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintLeft_toLeftOf=\"parent\"\r\n        app:layout_constraintRight_toRightOf=\"parent\"\r\n        app:layout_constraintTop_toTopOf=\"parent\" \/&gt;\r\n    &lt;TextView\r\n        android:id=\"@+id\/battery_level\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:textColor=\"@color\/black\"\r\n        android:textStyle=\"bold\"\r\n        android:textSize=\"50sp\"\r\n        app:layout_constraintBottom_toBottomOf=\"parent\"\r\n        app:layout_constraintLeft_toLeftOf=\"parent\"\r\n        app:layout_constraintRight_toRightOf=\"parent\"\r\n        app:layout_constraintTop_toTopOf=\"parent\" \/&gt;\r\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\r\n<\/pre>\n<p><b>6<\/b><span style=\"font-weight: 400;\">: After coding the activity_main.xml, come to the MainActivity.kt file and paste the below code.<\/span><\/p>\n<p><strong>Code: (MainActivity.kt)<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package com.example.techvidvanbroadcast\r\n\r\nimport android.annotation.SuppressLint\r\nimport android.content.BroadcastReceiver\r\nimport android.content.Context\r\nimport android.content.Intent\r\nimport android.content.IntentFilter\r\nimport android.os.BatteryManager\r\nimport android.os.Bundle\r\nimport android.util.Log\r\nimport android.widget.TextView\r\nimport androidx.appcompat.app.AppCompatActivity\r\n\r\nclass MainActivity : AppCompatActivity()\r\n{\r\n    private lateinit var displayBatteryLevel:TextView;\r\n    override fun onCreate(savedInstanceState: Bundle?)\r\n    {\r\n        super.onCreate(savedInstanceState)\r\n        setContentView(R.layout.activity_main)\r\n\r\n        \/\/Binding the text view with variable\r\n        \/\/to display the current battery level\r\n        \/\/of your phone\r\n        displayBatteryLevel = findViewById(R.id.battery_level);\r\n\r\n        \/\/Registering broadcast receiver\r\n        \/\/to receive the changes in battery level\r\n        registerReceiver(batteryBroadcastReceiver, IntentFilter(Intent.ACTION_BATTERY_CHANGED));\r\n    }\r\n\r\n    private val batteryBroadcastReceiver:BroadcastReceiver = object:BroadcastReceiver()\r\n    {\r\n        \/\/Called whenever there is a change in battery level\r\n        @SuppressLint(\"SetTextI18n\")\r\n        override fun onReceive(context: Context?, intent: Intent?)\r\n        {\r\n            if(intent?.action == \"android.intent.action.BATTERY_CHANGED\")\r\n            {\r\n                \/\/Fetching the current battery level\r\n                val battery_level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);\r\n\r\n                \/\/Setting the battery level on display\r\n                displayBatteryLevel.setText(\"$battery_level %\");\r\n\r\n                \/\/Making a log statement\r\n                \/\/to show th battery level changed\r\n                Log.d(\"TechVidvan\", \"Battery Level changed to : $battery_level\");\r\n            }\r\n        }\r\n\r\n    }\r\n\r\n    override fun onDestroy() {\r\n        super.onDestroy()\r\n\r\n        \/\/unregister the battery broadcast receiver\r\n        \/\/whenever the application is closed\r\n\r\n        unregisterReceiver(batteryBroadcastReceiver);\r\n    }\r\n}\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">After you are done with the above steps, just build your application and run it on your device or emulator. Open your Logcat at your bottom left and then type TechVidvan in the tag. You can see your Logcat as follows.<\/span><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Logcat_Output.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81546\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/Logcat_Output.png\" alt=\"Android Broadcast Receivers\" width=\"1852\" height=\"1048\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">In your device, you can see the application displaying your battery levels and updating the levels whenever there is a drop or rise in the battery level.<\/span><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/image9-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81560\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/06\/image9-1.jpg\" alt=\"Android Broadcast Receivers\" width=\"947\" height=\"1999\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p><span style=\"font-weight: 400;\">Through this article, you understood what broadcast receivers are in android and why they are used. Then, going further, you saw the two types of broadcast receivers. You also came across the various system-generated intents which are used according to your requirements.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> Lastly, you saw an implementation of broadcast receivers through a battery level displaying application.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article will help you understand what a broadcast receiver is and why it is used in Android Development. First, you will know the various types of Broadcast Receivers. Further, you will notice the&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":81541,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2791],"tags":[3670,3671,3672,3673,3674],"class_list":["post-81540","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-broadcast-receivers","tag-normal-broadcast-receiver-in-android","tag-ordered-broadcast-receiver-in-android","tag-system-generated-intents-in-android","tag-types-of-broadcast-receivers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Broadcast Receivers - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn what is broadcast receiver in android and why it is used. See its types and various system-generated intents used.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Broadcast Receivers - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn what is broadcast receiver in android and why it is used. See its types and various system-generated intents used.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-28T03:30:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-02T14:15:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Android_Broadcast_Receivers.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Broadcast Receivers - TechVidvan","description":"Learn what is broadcast receiver in android and why it is used. See its types and various system-generated intents used.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/","og_locale":"en_US","og_type":"article","og_title":"Android Broadcast Receivers - TechVidvan","og_description":"Learn what is broadcast receiver in android and why it is used. See its types and various system-generated intents used.","og_url":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2021-06-28T03:30:59+00:00","article_modified_time":"2024-08-02T14:15:47+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Android_Broadcast_Receivers.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Android Broadcast Receivers","datePublished":"2021-06-28T03:30:59+00:00","dateModified":"2024-08-02T14:15:47+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/"},"wordCount":1228,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Android_Broadcast_Receivers.jpg","keywords":["Android Broadcast Receivers","Normal Broadcast Receiver in Android","Ordered Broadcast Receiver in Android","System Generated Intents in Android","Types of Broadcast Receivers"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/","url":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/","name":"Android Broadcast Receivers - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Android_Broadcast_Receivers.jpg","datePublished":"2021-06-28T03:30:59+00:00","dateModified":"2024-08-02T14:15:47+00:00","description":"Learn what is broadcast receiver in android and why it is used. See its types and various system-generated intents used.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Android_Broadcast_Receivers.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2021\/06\/Android_Broadcast_Receivers.jpg","width":1200,"height":628,"caption":"Android Broadcast Receivers"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/android-broadcast-receivers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Android Broadcast Receivers"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/81540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=81540"}],"version-history":[{"count":2,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/81540\/revisions"}],"predecessor-version":[{"id":447560,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/81540\/revisions\/447560"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/81541"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=81540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=81540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=81540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}