As provided by https://developer.android.com/about/versions/13/features/photopicker, in Android 13, we have a new Photo Picker.
I try the code
val intent = Intent(MediaStore.ACTION_PICK_IMAGES)
The ACTION_PICK_IMAGES
can't be recognized. What library should I import to have that recognized?
Note I have already set my compileSdk and targetSdk to 32, i.e. Android 13.
android {
compileSdk 32
defaultConfig {
targetSdk 32
}
}
CodePudding user response:
API 32 is Android 12L, not Android 13.
You need to follow the Set up the Android 13 SDK instructions to use Android 13 APIs like the Photo Picker:
// Assuming you are using Android Gradle Plugin (AGP) 7.0.0 or higher
android {
compileSdkPreview "Tiramisu"
defaultConfig {
targetSdkPreview "Tiramisu"
}
}