断点广播接收器不触发 [英] Breakpoint not triggers in Broadcast Receiver
问题描述
问题pretty多少款项这一切,我想调试我的code在广播接收机的标题,但破发点不触发,我从 Debus执行我的Android应用程序作为 - > Android应用程序即可。请帮助!
下面是我的广播接收器code:
公共类报警扩展广播接收器{@覆盖
公共无效的onReceive(上下文CXT,意图意图){ 尝试{ 捆绑包= intent.getExtras();
字符串TASKNAME = bundle.getString(TASKNAME);
串taskRingTone = bundle.getString(TaskRingTone);
长endDateInMillis = bundle.getLong(EndDateInMillis); //如果ENDDATE达到禁用报警。
checkEndDate(CXT,(AlarmManager)cxt.getSystemService(Context.ALARM_SERVICE),endDateInMillis,pendingIntentId); 意向提醒=新意图(CXT,Reminder.class); reminder.putExtra(TASKNAME,TASKNAME);
reminder.putExtra(TaskRingTone,taskRingTone); reminder.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
cxt.startActivity(提示);
}赶上(例外五){ e.printStackTrace(); }}
}
和这里是code我使用登记我在清单接收器:
<接收安卓过程=:遥控机器人:名字=报警>< /接收器>
为什么你在一个单独的进程中运行您的接收器?
您必须把定义该接收方将得到什么类型的消息的某些意图过滤器:
例如:
<接收机器人:名字=报警>
&所述;意图滤光器>
<作用机器人:名字=android.provider.Telephony.SMS_RECEIVED/>
&所述; /意图滤光器>&下; /接收机GT;
这个接收器将火是收到短信的时候。
The title of the question pretty much sums it all, I want to debug my code in Broadcast Receiver but the break-point doesn't triggers, I am executing my android application from Debus As --> Android Application. Please help!
[edit]
Here is my Broadcast Receiver code:
public class Alarm extends BroadcastReceiver {
@Override
public void onReceive(Context cxt, Intent intent) {
try {
Bundle bundle = intent.getExtras();
String taskName = bundle.getString("TaskName");
String taskRingTone = bundle.getString("TaskRingTone");
long endDateInMillis = bundle.getLong("EndDateInMillis");
//to disable alarm if enddate reached.
checkEndDate(cxt, (AlarmManager)cxt.getSystemService(Context.ALARM_SERVICE), endDateInMillis, pendingIntentId);
Intent reminder = new Intent(cxt, Reminder.class);
reminder.putExtra("TaskName", taskName);
reminder.putExtra("TaskRingTone", taskRingTone);
reminder.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
cxt.startActivity(reminder);
} catch (Exception e) {
e.printStackTrace();
}
}
}
and here is code i am using to register my receiver in the manifest:
<receiver android:process=":remote" android:name="Alarm"></receiver>
why do you run your receiver in a separate process?
You have to put some intent filters that define what type of messages this receiver will get:
For example:
<receiver android:name=".Alarm">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter></receiver>
This receiver will fire when SMS message is received.
这篇关于断点广播接收器不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!