27 Mart 2025'ten itibaren AOSP'yi derlemek ve AOSP'ye katkıda bulunmak için aosp-main
yerine android-latest-release
kullanmanızı öneririz. Daha fazla bilgi için AOSP'de yapılan değişiklikler başlıklı makaleyi inceleyin.
Etkinleştirme bildirimleri için bildirim izni
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Android 13'teki bildirimler, etkinleştirme modelini kullanır. Bu, devre dışı bırakma modelini kullanan önceki Android sürümlerinden farklıdır. Android 13'te tüm uygulamaların bildirim istemleri göndermeden önce kullanıcılardan izin alması gerekir. Bu model, bildirim kesintilerini azaltmaya, bilgi yükünü en aza indirmeye ve kullanıcıların kendileri için önemli olan bildirimlere göre hangi bildirimlerin gösterileceğini kontrol etmelerine yardımcı olur. OEM'lerin, etkinleştirme modelini desteklemek için bildirim ve çalışma zamanı izin sistemlerinde değişiklik yapması gerekir.
Bu sayfada, OEM'lerin bu değişikliği desteklemek için neleri uygulaması gerektiği ve uygulamanın nasıl doğrulanacağı açıklanmaktadır.
Etkinleştirme bildirimleriyle ilgili değişiklikleri uygulama
Android 13'ten itibaren, uygulamaların bildirim gönderebilmesi için sistemden android.permission.POST_NOTIFICATION
çalışma zamanında istenen izni isteyerek bildirim gönderme niyetini beyan etmesi gerekir.
Android 13 ve sonraki sürümlerde, bir uygulamanın kullanıcıya bildirim gönderip gönderemeyeceğini belirleyen ayar izin sisteminde depolanır.
Android 13'ten önce bu ayar bildirim sisteminde depolanıyordu. Bu nedenle OEM'lerin, bir uygulamanın bildirim göndermesine izin verilip verilmediğine dair mevcut bildirim verilerini bildirim sisteminden çalışma zamanında istenen izin sistemine taşıması gerekir. OEM'ler, bildirim sisteminde bu verileri uygulama geliştiricilere gösteren mevcut API'leri de sürdürmelidir.
Bildirim ve izin sistemlerinde yapılan değişiklikler, kullanıcı bildirim davranışının etkinleştirme modeline dayanır ve Uygulama yönergeleri bölümünde açıklanır.
Etkinleştirme modelindeki kullanıcı bildirimlerinin davranışı
Aşağıdaki tabloda, Android 13 çalıştıran bir cihazdaki çeşitli uygulama sürümlerinin bildirim davranışı gösterilmektedir:
Android 13 çalıştıran cihaz |
Android 13 veya sonraki sürümleri hedefleyen uygulamalar |
Android 13'ten önceki sürümleri hedefleyen uygulamalar |
Yeni yükleme
|
Bildirimler, uygulama tarafından istenene kadar engellenir.
Uygulamalar, ne zaman izin isteyeceklerini kontrol eder.
|
Bildirimler, işletim sistemi tarafından istenene kadar engellenir.
Uygulama ilk çalıştırıldığında izin istenir.
|
Mevcut uygulama (yükseltme)
|
Uygulama tarafından istenene kadar bildirimlere izin verilir.
Uygulama ilk uygun çalıştırma sırasında istekte bulunana kadar geçici izin verilir.
|
İşletim sistemi tarafından istenene kadar bildirimlere izin verilir.
Geçici izin, uygulama ilk kez çalıştırılana kadar verilir.
|
Uygulamayla ilgili yönergeler
Referans uygulama için bildirim hizmetine, izin hizmetine ve politika hizmetine bakın. Varsayılan izin işleyicileri için istisnalar uygulamak istiyorsanız Çalışma Zamanı İzinleri başlıklı makaleyi inceleyin.
Uygulama sırasında, Android 13 veya daha eski SDK'ları hedefleyen uygulamalar için kullanıcı bildirimi davranışıyla ilgili aşağıdaki yönergeleri kullanın:
- Android 13 cihaza yeni yüklenen uygulamalar, kullanıcının izin istemesini onaylamadan bildirim göndermemelidir.
- Uygulama Android 13 ve sonraki sürümleri hedefliyorsa kullanıcı izninin ne zaman ve ne şekilde isteneceğini uygulama kontrol ettiğinden, uygulama tarafından istenene kadar bildirimler engellenmelidir.
- Uygulama Android 13'ten eski sürümleri hedefliyorsa bildirimler, işletim sistemi tarafından istenene kadar engellenmelidir. OS, uygulamanın ilk çalıştırıldığı sırada izin istemini göstermelidir.
Android 13'e yükseltme yapmadan önce cihazda bulunan veya yedekleme ve geri yükleme yoluyla geri yüklenen tüm uygulamaların, kullanıcı bu uygulamadan ilk kez bir etkinlik başlatana kadar bildirim göndermesine izin verilmelidir.
Android 13 ve sonraki sürümlerin SDK'sını hedefleyen uygulamalarda, kullanıcı daha önce bu uygulamanın bildirim ayarlarını uygulama veya NotificationChannel
düzeyinde özelleştirmediyse geçici izin verme işlemini iptal edin. Bu durumda, uygulamaların bildirim göndermeye devam edebilmesi için kullanıcıdan izin alması gerekir.
Android 13'ü hedefleyen yükseltilmiş bir uygulamanın geçici yükseltme izni kapsamında şu anda bildirim izni yoksa ve kullanıcı uygulamayı en az bir kez başlattıysa uygulamanın başka ön plan hizmeti çalıştırmasına izin verilmeden önce bildirim izni istemi gösterilmelidir.
Hedef SDK sürümü Android 13'ten eski olan uygulamalarda, kullanıcının uygulamadan bildirim almak isteyip istemediğini soran bir izin istemi göstermek için uygulama en az bir NotificationChannel
oluşturduktan sonra ilk etkinlik lansmanını kesin.
Bir kullanıcı daha önce yükseltme yapılan cihazdaki veya cihaza geri yüklenen bir yedekteki uygulama için bildirim ayarlarını uygulama ya da NotificationChannel
düzeyinde özelleştirdiyse uygulama düzeyindeki ayar, FLAG_PERMISSION_USER_SET
işaretiyle izin sistemine taşınmalıdır. Uygulama özellikle istemediği sürece kullanıcıya başka bildirim izni istemi gösterilmemelidir.
Yedekleme ve geri yükleme, Android 13 cihaz ile daha eski bir işletim sistemi sürümüne sahip cihaz arasında geriye ve ileriye dönük uyumlu olmalıdır. Android 13 cihazdan oluşturulan yedek veriler, önceki bir işletim sistemi sürümüne geri yüklenmelidir. Önceki bir işletim sistemi sürümünden oluşturulan yedek veriler ise Android 13 cihaza geri yüklenmelidir.
Devam eden medya oynatmayla ilişkili medya bildirimleri, bildirim izninden muaf olmalıdır.
Bildirim ve izin sistemlerindeki değişiklikleri doğrulama
Uygulamayı doğrulamak için aşağıdaki testleri çalıştırın:
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-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# Notification permission for opt-in notifications\n\nNotifications in Android 13 use an opt-in model, which\nis a change from previous Android versions, which use an opt-out model. In\nAndroid 13, all apps must ask users for permission before\nsending notification prompts. This model helps reduce notification\ninterruptions, minimizes information overload, and helps users control what\nnotifications appear based on what's important to them. To support the\nopt-in model, OEMs must implement changes in the notification and runtime\npermission systems.\n\nThis page describes what OEMs must implement to support this change and how\nto validate the implementation.\n\nImplement changes for opt-in notifications\n------------------------------------------\n\nStarting with Android 13, apps must declare their\nintent to send notifications by requesting the\n[`android.permission.POST_NOTIFICATION`](https://developer.android.com/about/versions/13/changes/notification-permission)\nruntime permission from the system before they can send notifications.\n\nIn Android 13 and higher, the setting that determines\nif an app can send notifications to the user is stored in the permission system.\nPrior to Android 13, this setting was stored in the\nnotification system. Hence, OEMs must migrate the existing notification data\nabout whether an app is allowed to send notifications, from the notification\nsystem into the runtime permission system. OEMs must also maintain existing APIs\nin the notification system that surface that data to app developers.\n\nChanges to the notification and permission systems are based on the\n[opt-in model of user notification behavior](#behavior-optin) and are\ndescribed in the [Guidelines for implementation](#guidelines-impl) section.\n\n### Behavior of user notifications in an opt-in model\n\nThe following table illustrates the notification behavior for various app\nversions on a device running Android 13:\n\n| Device on Android 13 | Apps targeting Android 13 or higher | Apps targeting versions lower than Android 13 |\n|------------------------|--------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|\n| New install | Notifications are blocked until prompted by the app. Apps control when to ask for permission. | Notifications are blocked until prompted by the OS. Permission is asked on the first run of the app. |\n| Existing app (upgrade) | Notifications are allowed until prompted by the app. Temporary permission is granted until the app asks on the first qualifying run. | Notifications are allowed until prompted by the OS. Temporary permission is granted until the first run of the app. |\n\n### Guidelines for implementation\n\nFor reference implementation, refer to\n[notification service](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/notification/),\n[permission service](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/pm/permission/) and\n[policy service](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/policy). To implement exceptions\nfor default permission handlers see\n[Runtime Permissions](/docs/core/permissions/runtime_perms#integration).\n\nDuring implementation, use the following guidelines on user notification\nbehavior for apps targeting Android 13 or lower SDKs:\n\n- Freshly installed apps on an Android 13 device must not send a notification without the user approving a permission prompt.\n - If the app targets versions Android 13 and higher, notifications must be blocked until prompted by the app as the app controls when and if to ask for user permission.\n - If the app targets versions lower than Android 13, notifications must be blocked until prompted by the OS. The OS must show the permission prompt on the first run of the app.\n- Any app that existed on the device prior to an upgrade to\n Android 13, or any app that was restored through backup\n and restore, must be allowed to send notifications until the first time the user\n launches an activity from that app.\n\n - For apps that target SDK of versions Android 13\n and higher, if the user hasn't previously customized notification settings for\n this app at the app or `NotificationChannel` level, revoke the temporary\n permission grant. Apps must then ask the user for permission before being\n allowed to continue to send notifications.\n\n If an upgraded app targeting Android 13 doesn't\n currently have the notification permission through the temporary upgrade\n grant, and the user has launched it at least once, the app must show a\n notification permission prompt before it's allowed to run any further foreground\n services.\n - For apps that have a target SDK of versions lower than\n Android 13,\n [intercept](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/core/java/com/android/server/wm/ActivityInterceptorCallback.java)\n the first activity launch after the app has created at least one `NotificationChannel`\n to show a permission prompt asking if the user wants to receive notifications\n from the app.\n\n If a user previously customized notification settings at the\n app or `NotificationChannel` level for an app on the upgrading device or in a\n backup being restored to the device, the app level setting must be migrated into\n the permission system with the `FLAG_PERMISSION_USER_SET` flag. No further\n notification permission prompt must be shown to the user unless the app\n specifically asks it to be.\n- Backup and restore must be backward and forward compatible between an\n Android 13 device and a device from an earlier OS\n version. Backup data generated from an Android 13\n device must restore onto an earlier OS version, and backup data from an earlier\n OS version must restore onto an Android 13 device.\n\n- Media notifications associated with ongoing media playback must be exempt\n from the notification permission.\n\nValidate changes to the notification and permission systems\n-----------------------------------------------------------\n\nTo validate the implementation, run the following tests:\n\n- Unit tests as specified in [`PreferencesHelperTest`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/PreferencesHelperTest.java),\n [`NotificationManagerServiceTest`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java).\n\n- Any manual test that tests upgrades and backup and restore.\n\n- Any CTS Permission and Notification system test that sends notifications.\n Some of these tests are located in [cts/tests/tests/permission/](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Permission/tests/cts/permission/src/android/permission/cts/),\n [NotificationManagerTest.java](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/tests/tests/notification/src/android/app/notification/current/cts/NotificationManagerTest.java?q=NotificationManagerTest.java),\n and [cts/tests/tests/notificationlegacy/](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/tests/tests/notificationlegacy/)."]]