FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    Android BroadCast broadcast knowledge points

     

    BroadCastReceiver:
    1) The broadcast receiver is a component that focuses on receiving broadcast notification information and making corresponding processing. Many broadcasts originate from the system—for example, notification of a time zone change, low battery level, a photo taken, or a user changed language options. Applications can also broadcast-for example, to notify other applications that some data has been downloaded and is in a usable state.

    2) The application can have any number of broadcast receivers to respond to all the notification messages it is interested in. All receivers inherit from the BroadcastReceiver base class.

    3) The broadcast receiver has no user interface. However, they can start an activity in response to the information they receive, or use NotificationManager to notify the user. Notifications can be used in many ways to attract the user's attention-flashing the backlight, vibrating, playing a sound, and so on. Generally speaking, a persistent icon is placed on the status bar, and the user can open it and get the message.

     

    How many kinds of broadcasts are there? What is the difference between them?

    Broadcasting is divided into two different types: "Normal broadcasts" and "Ordered broadcasts". Ordinary broadcast is completely asynchronous and can be received by all receivers at the same time (logically). The efficiency of message delivery is relatively high, but the disadvantage is that the receiver cannot pass the processing result to the next receiver, and the broadcast cannot be terminated. The spread of Intent.

    However, orderly broadcast is based on the priority declared by the receiver, and the receiver receives the broadcast in turn. For example, if the level of A is higher than B, and the level of B is higher than C, then the broadcast is first transmitted to A, then to B, and finally to C. The priority level is declared in the android:priority attribute of the intent-filter element. The larger the number, the higher the priority level. The value range is from -1000 to 1000. The priority level can also be set by calling setPriority() of the IntentFilter object. Receivers of orderly broadcast can terminate the broadcast of the broadcast Intent. Once the broadcast of the broadcast Intent is terminated, subsequent receivers will not be able to receive the broadcast.

    In addition, the receiver of an ordered broadcast can pass the data to the next receiver. For example, after A gets the broadcast, it can store the data in its result object. When the broadcast is sent to B, B can get the result object from A. Get the data stored by A in.

    Context.sendBroadcast() sends an ordinary broadcast, and all subscribers have the opportunity to obtain and process it.

    Context.sendOrderedBroadcast() sends an ordered broadcast. The system will execute the receivers one by one according to the priority declared by the receiver. The previous receiver has the right to terminate the broadcast (BroadcastReceiver.abortBroadcast()), if the broadcast is received by the previous If the recipient is terminated, the subsequent receivers will no longer be able to get the broadcast. For ordered broadcast, the previous receiver can store the data in the result object through the setResultExtras(Bundle) method, and then pass it to the next receiver. The next receiver can get the previous one through the code: Bundle bundle = getResultExtras(true)) Data stored by the receiver in the result object

     

    The difference between local broadcast and global broadcast

    BroadcastReceiver is a way to communicate between applications, between applications and systems, and within applications

    LocalBroadcastReceiver only sends and receives broadcasts within its own application, that is, only its own application can receive it. The data is safer broadcast only in this program, and it is more efficient.

    BroadcastReceiver use

    1. Make an intent (can carry parameters)

    2. Use sendBroadcast() to pass in the intent;

    3. Make the broadcast receiver class inherit BroadcastReceiver and override the onReceive method (or you can make an anonymous inner class or something)

    4. Register the broadcast receiver in java (dynamic registration) or directly in the Manifest (static registration). Use registerReceiver() to pass in the receiver and intentFilter

    5. Unregistering can be in the OnDestroy() function, unregisterReceiver() is passed into the receiver

    LocalBroadcastReceiver use

    LocalBroadcastReceiver cannot be registered statically, and can only be registered dynamically.

    Used when sending and registering, LocalBroadcastManager's sendBroadcast method and registerReceiver method

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us