INNER CODE UNIT · Java
onCreate
rom1v/sndcpy · app/src/main/java/com/rom1v/sndcpy/RecordService.java:59
public void onCreate() {
super.onCreate();
Notification notification = createNotification(false);
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, getString(R.string.app_name), NotificationManager.IMPORTANCE_NONE);
getNotificationManager().createNotificationChannel(channel);
startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String action = intent.getAction();
if (ACTION_STOP.equals(action)) {
stopSelf();
return START_NOT_STICKY;
}