On your notification builder use .setOngoing(True) and this will prevent the user from removing your notification.
and
n.flags |= Notification.FLAG_NO_CLEAR;
We can assign the notification to a service and start it as foreground
startForeground(101,notification);
References
https://stackoverflow.com/questions/22555943/android-how-to-create-a-permanent-notification
https://questdot.com/android-foreground-service/