I`ve got two classes with notifications and background service:
public class ActivityTransitionService extends Service {

    private static final int NOTIFICATION_ID = 1;
    private static final String CHANNEL_ID = "activity_recognition_channel";

    private PendingIntent transitionPendingIntent;

    @Override
    public void onCreate() {
        super.onCreate();

        // Create the notification channel
        createNotificationChannel();

        // Start the service as a foreground service with the notification
        startForegroundServiceWithNotification();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        // Handle stop action from notification
        if (intent != null && "STOP_SERVICE".equals(intent.getAction())) {
            stopSelf();
            return START_NOT_STICKY;
        }

        // Check for permissions
        if (!EasyPermissions.hasPermissions(this, Manifest.permission.ACTIVITY_RECOGNITION)) {
            stopSelf(); // Stop service if permissions are not granted
            return START_NOT_STICKY;
        }

        // Start activity transition updates
        startActivityTransitionUpdates();

        return START_STICKY;
    }

    private void startForegroundServiceWithNotification() {
        Notification notification = createNotification();

        // For Android O and above, you must use startForeground with a notification
        startForeground(NOTIFICATION_ID, notification);
    }

    private Notification createNotification() {
        // Intent to launch the MainActivity when the notification is tapped
        Intent notificationIntent = new Intent(this, MainActivity.class);
        PendingIntent pendingIntent;

        pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE);

        // Optional: Add a stop action to stop the service from the notification
        Intent stopIntent = new Intent(this, ActivityTransitionService.class);
        stopIntent.setAction("STOP_SERVICE");
        PendingIntent stopPendingIntent = PendingIntent.getService(this, 0, stopIntent, PendingIntent.FLAG_IMMUTABLE);

        NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID).setContentTitle("Activity Recognition").setContentText("Activity recognition service is running")
                //.setSmallIcon(R.drawable.ic_notification) // Ensure you have an icon in drawable
                .setContentIntent(pendingIntent).setPriority(NotificationCompat.PRIORITY_LOW).setOngoing(true).addAction(android.R.drawable.ic_menu_close_clear_cancel, "Stop", stopPendingIntent); // Use a suitable icon

        return builder.build();
    }

    private void createNotificationChannel() {
        // Only for Android O and above
        CharSequence name = "Activity Recognition Service";
        String description = "Channel for activity recognition service";
        int importance = NotificationManager.IMPORTANCE_LOW; // Set importance to low to minimize prominence
        NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
        channel.setDescription(description);

        // Register the channel with the system
        NotificationManager notificationManager = getSystemService(NotificationManager.class);
        notificationManager.createNotificationChannel(channel);
    }

    private void startActivityTransitionUpdates() {
        // Verify that we have permission
        if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACTIVITY_RECOGNITION) != PackageManager.PERMISSION_GRANTED) {
            Toast.makeText(this, "Activity recognition permission not granted", Toast.LENGTH_SHORT).show();
            stopSelf();
            return;
        }

        // Build transitions you're interested in
        List<ActivityTransition> transitions = new ArrayList<>();
        // Define the activity types you're interested in
        int[] activityTypes = {DetectedActivity.WALKING, DetectedActivity.RUNNING, DetectedActivity.IN_VEHICLE, DetectedActivity.ON_BICYCLE, DetectedActivity.STILL};

        // Add enter and exit transitions for each activity type
        for (int activityType : activityTypes) {
            transitions.add(new ActivityTransition.Builder().setActivityType(activityType).setActivityTransition(ActivityTransition.ACTIVITY_TRANSITION_ENTER).build());
            transitions.add(new ActivityTransition.Builder().setActivityType(activityType).setActivityTransition(ActivityTransition.ACTIVITY_TRANSITION_EXIT).build());
        }

        ActivityTransitionRequest request = new ActivityTransitionRequest(transitions);

        // Create a pending intent to handle the transitions
        Intent intent = new Intent(this, TransitionReceiver.class);
        transitionPendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);

        // Register for activity transitions
        ActivityRecognition.getClient(this).requestActivityTransitionUpdates(request, transitionPendingIntent).addOnSuccessListener(aVoid -> {
            Log.i("ActivityTransitionService", "Successfully started activity updates");
        }).addOnFailureListener(e -> {
            Log.e("ActivityTransitionService", "Failed to start activity updates", e);
            // Optionally stop the service or handle the failure accordingly
            stopSelf(); // Stop the service if unable to start updates
        });
    }

    @SuppressLint("MissingPermission")
    private void stopActivityTransitionUpdates() {
        if (transitionPendingIntent != null) {
            ActivityRecognition.getClient(this).removeActivityTransitionUpdates(transitionPendingIntent).addOnSuccessListener(aVoid -> {
                Log.i("ActivityTransitionService", "Successfully stopped activity updates");
            }).addOnFailureListener(e -> {
                Log.e("ActivityTransitionService", "Failed to stop activity updates", e);
            });
        }
    }

    @Override
    public void onDestroy() {
        // Remove activity transition updates
        stopActivityTransitionUpdates();
        super.onDestroy();
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}
public class SensorService extends Service {

    private SensorRecorder sensorRecorder;
    private static final int NOTIFICATION_ID = 2;
    private static final String CHANNEL_ID = "sensor_service_channel";

    @Override
    public void onCreate() {
        super.onCreate();

        // Initialize SensorRecorder
        sensorRecorder = new SensorRecorder(this, new SensorRecorder.SensorDataListener() {
            @Override
            public void onSensorData(SensorEvent event) {
                // Handle sensor data
                Log.d("SensorService", "Sensor: " + event.sensor.getName() + ", Values: " + Arrays.toString(event.values));
            }
        });

    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        sensorRecorder.startRecording();

        return START_STICKY;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (sensorRecorder != null && sensorRecorder.isRecording()) {
            sensorRecorder.stopRecording();
        }
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

to make my code clear I`ve created two additional helper classes:
package com.google.sl.util;
import android.app.Service;
import com.google.sl.data.SensorRecorder;

public class ForegroundService extends Service {

    private SensorRecorder sensorRecorder;
    private boolean isActivityRecognitionActive = false;
    private boolean isSensorRecordingActive = false;

    // Define actions
    public static final String ACTION_START_ACTIVITY_RECOGNITION = "ACTION_START_ACTIVITY_RECOGNITION";
    public static final String ACTION_STOP_ACTIVITY_RECOGNITION = "ACTION_STOP_ACTIVITY_RECOGNITION";
    public static final String ACTION_START_SENSOR_RECORDING = "ACTION_START_SENSOR_RECORDING";
    public static final String ACTION_STOP_SENSOR_RECORDING = "ACTION_STOP_SENSOR_RECORDING";

    // onCreate(), onStartCommand(), and other methods...
}

package com.google.sl.util;

import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

import androidx.core.app.NotificationCompat;

import com.google.sl.ui.MainActivity;

public class NotificationHelper {

    private static final String CHANNEL_ID = "foreground_service_channel";
    private Context context;

    public NotificationHelper(Context context) {
        this.context = context;
        createNotificationChannel();
    }

    public Notification createNotification(String title, String content) {
        Intent notificationIntent = new Intent(context, MainActivity.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE);

        return new NotificationCompat.Builder(context, CHANNEL_ID)
                .setContentTitle(title)
                .setContentText(content)
                .setSmallIcon(R.drawable.ic_notification)
                .setContentIntent(pendingIntent)
                .build();
    }

    private void createNotificationChannel() {
        // Create the NotificationChannel...
    }
}

help me to make it all work and correct/repair my classes