cruisekda.blogg.se

Android studio intent filter url example
Android studio intent filter url example











2.1 Layout Xml File.ĬustomBroadcastActivity.java package .activity

android studio intent filter url example

Intent.putExtra(ABORT_ORDERED_CUSTOM_BROADCAST, ABORT_ORDERED_CUSTOM_BROADCAST) Intent intent = new Intent(CUSTOM_BROADCAST_ACTION) So you can not see toast popup message for custom broadcast receiver one. This information will make the first broadcast receiver to abort the broadcast.īecause the receiver two receive the broadcast first, so it will abort the broadcast. When you click the third button, it use below code to send an ordered broadcast with extra String type information. The toast popup message at the screen bottom also confirm this. You can see receiver two’s priority value is bigger than receiver one, so it will receive the custom broadcast first. The value the bigger, the first to receive the broadcast in the receiver chain. The receiver’s intent-filter child tag add a new android:priority attribute. This broadcast will also be received by the configured broadcast receiver order in below AndroidManifest.xml. When you click the second button, it will use below code to send an ordered broadcast.

android studio intent filter url example

If you can not watch the above video, you can see it on the youtube URL 1.2 Send Custom Ordered Broadcast Example. The custom receiver one will receive the broadcast event first.ĪndroidManifest.xml without setting broadcast receiver priority. You can see the toast popup message at screen bottom. Intent intent = new Intent(CUSTOM_BROADCAST_ACTION) īecause the two broadcast receiver is not ordered, so they will receive the broadcast almost at same time.













Android studio intent filter url example