简体   繁体   中英

Broadcast intents not working?

I have been following TheNewBoston tutorials on Broadcast intents, but I have an issue. Basically, I have two apps:

1) Recieve Broadcast

2)Send_Broadcast.

They do what their name suggests using intents, and Recieve Broadcast responds to the broadcast by displaying a toast on the screen. At this point of time, I have built both apps, and am getting no errors. After running both though, nothing happens when I send the broadcast by pushing the button. Please help me with this issue, as I have been trying to fix this for almost two hours now! (I have also re-set the api from 8-14)

This is the java class for send broadcast, it sends the broadcast when you push this button:

发送

This is the XML for send broadcast, it sends the broadcast when you push this button:

发送XML

Here is the receiver:

Reciever

And the manifest which filters out certain broadcasts:

表现

I have not added a layout to recieve broadcast, it works behind the scenes. Thank you so much for all of your help, I really appreciate it. If you need more information, feel free to ask!

I would appreciate any feedback! :)

Did you intend to put your filter on your receiver?

    <receiver android:name=".RecieveBroadcast">
        <intent-filter>
            <action android:name="com.example.xxx.send_broadcast" />
        </intent-filter>
    </receiver>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM