Android manifest POST_NOTIFICATIONS missing import

Viewed 2437

Trying to implement the notification permission for android 13 or "Tiramisu" but failed to get the import for that permission.

Currently: targeted SDK version is 32 compile SDK version is 32

I've declared it also in manifiest as below:

 <uses-permission android:name="android.permission.POST_NOTIFICATIONS"

import i'm using:

import android.Manifest
  • But even not getting import in my fragment.

enter image description here

4 Answers

After hours of struggle, there's the solution from where you can get this.

  • compileSdkPreview "Tiramisu"

  • targetSdkPreview "Tiramisu"

      android {
      namespace 'com.example.myapplication'
      //    compileSdk 32
     compileSdkPreview "Tiramisu"
    
      defaultConfig {
         applicationId "com.example.myapplication"
         minSdk 23
         //        targetSdk 32
         targetSdkPreview "Tiramisu"
         versionCode 1
         versionName "1.0"
    
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
    

I solved it by using compileSdkVersion 33 in the gradle file at the Module level. Then it allowed me to use the POST_NOTIFICATIONS permission without any issue. Gradle Settings

I faced the same problem,

Steps to fix :

Install SDK Platforms SDK Platform 33 Android TiramisuPrivacy Sandbox Preview

enter image description here

Install SDK Tools : Android SDK build Tools 33 enter image description here

Just add this import:

import android.Manifest
Related