0

我一直在寻找为什么我的通知没有显示在通知栏中并且似乎无法理解为什么不显示的原因.. 有没有人看到需要在这段代码中做些什么?

NotificationManager nm = (NotificationManager)
                getSystemService(NOTIFICATION_SERVICE);
            NotificationCompat.Builder notif = new NotificationCompat.Builder(DisplayNotification.this)
                                                .setContentTitle("Due")
                                                .setContentText("Do it fast!")
                                                .setSmallIcon(R.drawable.book);

            //---100ms delay, vibrate for 250ms, pause for 100 ms and
            // then vibrate for 500ms---
            notif.setVibrate(new long[] { 100, 250, 100, 500});        
            nm.notify(notifID, notif.build());

    }
4

0 回答 0