直接复制测试用。
final NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder builder = new NotificationCompat.Builder(context); // params int smallIconId = R.mipmap.ic_launcher; Bitmap largeIcon = ((BitmapDrawable) context.getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(); String info = "逢赌必输:我是通知内容"; // action when clicked Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse("host://anotheractivity")); builder.setLargeIcon(largeIcon) .setSmallIcon(smallIconId) .setContentTitle("逢赌必输") .setContentText(info) .setTicker(info) .setContentIntent(PendingIntent.getActivity(context, 0, intent, 0)); final Notification n = builder.getNotification(); nm.notify("NotificationActivityDemo".hashCode(),n);