broadcastreceiver - Android: Broadcast not received when Action is specified -
broadcastreceiver - Android: Broadcast not received when Action is specified -
i've got problem i'm researching few hours now.
i want send broadcast 1 activity another. send broadcast activity by:
intent = new intent("test"); i.setaction("testaction"); sendbroadcast(i);
and receive in activity b by:
private broadcastreceiver updateguireceiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { log.e("test", "test") intent.getaction().equals(("testaction")){ ... } } } .... registerbroadcastreceiver(updateguireceiver);
but receiver never gets called if specify action. if don't (uncomment setaction), broadcast isn't beingness received, attached extras , works perfectly.
in receiver activity, alter line
registerbroadcastreceiver(updateguireceiver);
to
intentfilter filter = new intentfilter(); filter.addaction("testaction"); registerreceiver(updateguireceiver, filter);
hope help! :d
android broadcastreceiver
Comments
Post a Comment