Examples of Foreground services usage in production apps?

Foreground services are essential for tasks that require ongoing operation even when the app is not in the foreground, such as music playback, location tracking, or long-running file downloads. This HTML document provides examples of how foreground services can be utilized in production apps effectively.
Foreground services, Android services, production apps, location tracking, music playback, file downloads
        // Starting a Foreground Service in Android
        public class MyForegroundService extends Service {
            @Override
            public void onCreate() {
                super.onCreate();
                // Creating a notification for the foreground service
                Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
                        .setContentTitle("Service Running")
                        .setContentText("My service is running in the foreground")
                        .setSmallIcon(R.drawable.ic_service_icon)
                        .build();
                
                startForeground(1, notification);
            }
        
            @Override
            public int onStartCommand(Intent intent, int flags, int startId) {
                // Your code to perform background operations
                return START_STICKY;
            }

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

Foreground services Android services production apps location tracking music playback file downloads