通知没有出现在Android 19中

时间:2016-08-14 20:52:13

标签: android android-4.4-kitkat

我尝试使用通知进行通知,如下所示:主要活动有以下代码,但没有显示任何内容。

 mEmailSignInButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            NotificationCompat.Builder builder =
                    new NotificationCompat.Builder(MainActivity.this)
                            .setContentTitle("Enable Call Permission")
                            .setContentText("Please Enable or Accept call permission");
            int NOTIFICATION_ID = 12345;

            Intent targetIntent = new Intent(MainActivity.this, PermissionActivity.class);

            PendingIntent contentIntent = PendingIntent.getActivity(MainActivity.this, 0, targetIntent, PendingIntent.FLAG_UPDATE_CURRENT);
            builder.setContentIntent(contentIntent);
            NotificationManager nManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            nManager.notify(NOTIFICATION_ID, builder.build());
            save();
        }
    });

1 个答案:

答案 0 :(得分:1)

如果没有图标,它似乎无法运作。

.setSmallIcon(R.drawable.small_icon);

看到这篇文章:

Notification Not showing