谁都能告诉我应该使用意图过滤器和广播接收机的时间吗?
和
解决方法:
abroadcastreceiverisacomponentthatrespondstosystem-wide
broadcast announcements.manybroadcastsoriginatefromthesystem-for
example,abroadcastannouncingthatthescreenhasturnedoff,the
battery is low,orapicturewascaptured.applicationscanalso
initiate broadcasts—for example,to let other applications know that
somedatahasbeendownloadedtothedeviceandisavailableforthem
to use.althoughbroadcastreceiversdon’tdisplayauserinterface,
theymaycreateastatusbarnotificationtoalerttheuserwhena
broadcasteventoccurs.more commonly,though,a broadcast receiver is
justa " gateway " toothercomponentsandisintendedtodoavery
minimalamountofwork.for instance,it might initiate a service to
perform some work based on the event。
可以以两种方式使用广播接收机。
1 )注册事件并取消注册。 注册事件时,必须小心操作。 从APP应用程序发送包含此操作的广播时将触发。
2 )使用广播reciver注册清单文件,并在清单文件中的intent过滤器中提及操作的第二种方法。
Intent过滤器只是“我们日常生活中使用的过滤器”的简单说法。过滤调用它的操作。
活动接收器和广播接收器的互联网滤波器相同。 主要功能是过滤动作。 那取决于我们怎么利用。 我们指定的清单文件中的每个APP应用程序都有一个主要示例
对于我们的启动器活动,此活动是我们的启动器活动,建议在我们的APP应用程序开始时首先执行。 如果你不指定那个的话,你的APP应用程序就不能启动。 此外,也不能在广播接收机的意图过滤器中指定这些类型的过滤器。 这些不是APP应用程序的启动器。
标签:安卓、安卓- intent、intentfilter、broadcastreceiver
资料来源: https://codeday.me/bug/2019 08 24/1710459.html