广播接收器不调用

时间:2013-02-15 07:33:22

标签: android

我正在做一个基本上是提醒应用程序的应用程序。它将保存数据库中的所有详细信息,如日期,时间,收件人编号,内容文本等,之后它将使用此存储的此详细信息发送短信日期和时间

实际上我没有使用任何日历实例 我打算做的是,设置一个每天调用然后搜索的广播接收器 数据库,如果发现日期,它将使用该日期和时间发送短信

现在我要做的是创建一个调用everday的广播接收器

我使用的代码是

    public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
    System.out.println("Broadcast receiver Started");
     Intent dailyUpdater = new Intent(context, MyService.class);
        context.startService(dailyUpdater);
        Log.d("AlarmReceiver", "Called context.startService from AlarmReceiver.onReceive");

还在行动中注册了Time_changed

但接收者没有打电话可以帮助我解决这个问题

1 个答案:

答案 0 :(得分:0)

广播接收器是后台进程。这可能对你有帮助..

Intent dailyUpdater = new Intent(context, MyService.class);
dailyUpdater.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startService(dailyUpdater);