2
由于某种原因,当我在我的应用程序中显示通知时会振动并发出噪音,但手机顶部不会显示横幅。我需要做一个特定的命令吗?android通知横幅不显示
public Notification getNotification(String message) {
Intent intent = new Intent(serviceContext, NotificationGenerator.class); //not sure how
// this class i pass matters
PendingIntent pi = PendingIntent.getActivity(serviceContext, 0, intent, 0);
NotificationCompat.Builder builder = new NotificationCompat.Builder(serviceContext)
.setContentTitle(message)
.setContentText(message)
.setSmallIcon(R.drawable.dominos_icon)
.setContentIntent(pi);
Notification n = builder.build();
n.defaults = Notification.DEFAULT_ALL;
return n;
}
请包括用来生成通知的代码。 –
对不起。刚添加它。 – mgild