Ön plan hizmetini durdurma
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Bir ön plan hizmetinin ön planda çalışmayı durdurmasını istiyorsanız iki seçeneğiniz vardır. Hizmeti durdurabilir veya hizmetin çalışmasına izin verip ön plandan kaldırabilirsiniz.
Ön plan hizmetlerini diğer hizmetleri durdurduğunuz şekilde durdurabilirsiniz. Hizmet kendi stopSelf()
yöntemini çağırabilir veya başka bir bileşen stopService()
yöntemini çağırarak hizmeti durdurabilir. Hizmeti ön planda çalışırken durdurursanız bildirimi kaldırılır.
Bir hizmeti ön plandan kaldırmak için hizmetin içinden
stopForeground(int)
işlevini çağırın. Bu yöntem, durum çubuğu bildiriminin de kaldırılıp kaldırılmayacağını belirten bir boole değeri alır. Hizmet çalışmaya devam eder ancak artık ön plan hizmeti değildir.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-27 UTC.
[null,null,["Son güncelleme tarihi: 2025-08-27 UTC."],[],[],null,["If you want a foreground service to stop running in the foreground, you have\ntwo options. You can stop the service, or you can leave the service\nrunning but remove it from the foreground.\n\nYou can stop a foreground service\n[the same way you would stop any service](/develop/background-work/services#Stopping). The service can\ncall its own [`stopSelf()`](/reference/android/app/Service#stopSelf()) method, or another component can stop it\nby calling [`stopService()`](/reference/android/content/Context#stopService(android.content.Intent)). If you stop the service while it runs\nin the foreground, its notification is removed.\n\nTo remove a service from the foreground, call\n[`stopForeground(int)`](/reference/android/app/Service#stopForeground(int))\nfrom inside the service. This method takes a boolean, which indicates whether to\nremove the status bar notification as well. The service continues to run, but\nit is no longer a foreground service."]]