通知未显示在 android 19
Notification not showing up in android 19
我正在尝试使用如下通知进行通知:主要 activity 具有以下代码,但没有显示任何内容。
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();
}
});
没有图标好像不行
.setSmallIcon(R.drawable.small_icon);
看到这个post:
Notification Not showing
我正在尝试使用如下通知进行通知:主要 activity 具有以下代码,但没有显示任何内容。
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();
}
});
没有图标好像不行
.setSmallIcon(R.drawable.small_icon);
看到这个post:
Notification Not showing