我尝试使用通知进行通知,如下所示:主要活动有以下代码,但没有显示任何内容。
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();
}
});
答案 0 :(得分:1)