int NOTIFICATION_ID = Integer.MAX_VALUE; private static final String CHANNEL_ID = "debug"; public static void showDebugMenuNotification(Context c) { Intent i = new Intent(c, DebugMenuActivity.class); PendingIntent pi = PendingIntent.getActivity(c, 0, i, PendingIntent.FLAG_CANCEL_CURRENT); Notification n = buildNotification(c, pi); NotificationManager nm = getNotificationManager(c); nm.notify(NOTIFICATION_TAG, NOTIFICATION_ID, n); } private static Notification buildNotification(Context c, PendingIntent pi) { PackageManager pm = c.getPackageManager(); String applicationName = c.getApplicationInfo().loadLabel(pm).toString(); NotificationCompat.Builder builder = new NotificationCompat.Builder(c, CHANNEL_ID); builder.setTicker("debug menu"); builder.setOngoing(true); builder.setContentTitle(applicationName); builder.setContentText("λοϓ͢ΔͱDebug Menu͕։͖·͢"); builder.setSmallIcon(R.drawable.ic_notification_small); builder.setContentIntent(pi); builder.setAutoCancel(false); return builder.build(); } private static NotificationManager getNotificationManager(Context c) { return (NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE); }