Android 安卓:欢迎来电时敬酒
我正在尝试在互联网上找到的这段代码…它应该使用广播接收器为即将到来的呼叫事件显示祝酒词,但在我的带有安卓1.6的htc纹身上,它不起作用(它不显示任何祝酒词) 当然,我已经在我的清单上注册了广播接收人:Android 安卓:欢迎来电时敬酒,android,call,broadcastreceiver,Android,Call,Broadcastreceiver,我正在尝试在互联网上找到的这段代码…它应该使用广播接收器为即将到来的呼叫事件显示祝酒词,但在我的带有安卓1.6的htc纹身上,它不起作用(它不显示任何祝酒词) 当然,我已经在我的清单上注册了广播接收人: <receiver android:name=".HFBroadcastIncomingRecevier"> <intent-filter> <action android:name="android.intent.action.PHONE_STA
<receiver android:name=".HFBroadcastIncomingRecevier">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
使用此权限:
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
有什么想法吗?将意向过滤器更改为“操作”\u“新建”\u“传出”\u呼叫
<receiver android:name=".YourClassName" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
}
这是为传入的消息相应地更改它和一个,从我看到的,我的问题缺少部分,因此这是清单中的接收者:这是权限:编辑。他们现在在这里。别忘了在编辑字段上方使用大括号图标来改进代码的格式。是否调用了registerreceiver()?是的,这是我的原始源代码
<receiver android:name=".YourClassName" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
public void onReceive(Context context, Intent intent)
{
String mAction = intent.getAction();
if(!mAction.equals("android.provider.Telephony.SMS_RECEIVED"))
return;
Toast.makeText(context, "Intent Received", Toast.LENGTH_LONG).show();