[英]how to call an broadcast receiver from an activity?
I have a broadcast class that blocks the incoming call. 我有一个广播类,它阻止来电。 I want to call that broadcast receiver from the activity ?
我想从活动中呼叫那个广播接收者吗? Can any one help me fix this.
谁能帮我解决这个问题。 I appreciate your help.
我感谢您的帮助。 1. Class A extends activity will call Class B that extends BroadcastReceiver, now I want to block calls , only based on certain requirements, which are checked in Class A, if true then call the Class B (or block the call in short)
1. A类扩展活动将调用扩展BroadcastReceiver的B类,现在我只想根据某些要求阻止调用,这些要求已在A类中进行了检查,如果为true,则调用B类(或简称为阻止调用)
You can start BroadcastReceiver
from Activity as: 您可以通过Activity从以下方式启动
BroadcastReceiver
:
public static final String BROADCAST_ACTION_NAME = "PACKAGE_NAME.ACTION_NAME";
Intent intent = new Intent(BROADCAST_ACTION_NAME);
Bundle extras = new Bundle();
extras.putString("data", "any_string");
intent.putExtras(extras);
//send Broadcast from Activity
sendBroadcast(intent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.