0
我很惭愧地问这个问题,因为我知道的更好,但现在我很困难!当我点击通知时,我写了我的代码来调用一个活动。然而,加班时我点击通知,活动不会开始,而是通知消失。我有一个Receiver.java,它扩展了BroadcastReceiver,然后调用包含我设置的通知生成器的Alarm Service。这里是我使用的通知生成器:当通知被点击时,通知页面没有出现
Intent intent1=new Intent(Alarm.this,NotificationPage.class);
PendingIntent pendingIntent=PendingIntent.getActivity(Alarm.this,1,intent1,0);
NotificationCompat.Builder builder=new NotificationCompat.Builder(Alarm.this);
builder.setAutoCancel(true);
builder.setContentTitle(from);
builder.setContentText(message);
builder.setSmallIcon(R.drawable.icon);
builder.setContentIntent(pendingIntent);
builder.setSound(sound);
builder.build();
nm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notify=builder.getNotification();
notify.flags=Notification.FLAG_AUTO_CANCEL;
nm.notify(0, notify);
一切,但通知页面弹出,工作。我在设备上测试了它,该应用没有崩溃,所以我知道没有错误。 请帮忙!
失意编码器ATM
它每分钟都不是每一天都像我想要的 – droidnoob
@droidnoob它到您的服务,它要求通知是否显示通知在每一天或每一分钟,检查您的服务,并确保您每天都调用notifyIncomingRequest方法每一分钟。 (顺便说一句,我无法看到你的评论中提到的任何信息,作为你主要问题的一部分) –