79357114

Date: 2025-01-15 05:03:42
Score: 0.5
Natty:
Report link

Solution 1

Add these dependencies:

implementation("com.google.android.gms:play-services-base:18.3.0")

This is your manifest file

<manifest>
    <application>
        <!-- Photo Picker Module -->
        <service 
            android:name="com.google.android.gms.metadata.ModuleDependencies"
            android:enabled="false"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
            </intent-filter>
            <meta-data 
                android:name="photopicker_activity:0:required" 
                android:value="" />
        </service>

        <!-- Play Services Availability -->
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>

    <!-- Required Permissions -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

Solution 2

Add these dependencies:

implementation("com.google.android.gms:play-services-auth:20.7.0")
implementation("androidx.activity:activity:1.8.0")

Then use this code to implement photo picker:

val pickSingleMedia = registerForActivityResult(PickVisualMedia()) { uri ->
    if (uri != null) {
        // Handle selected media
    }
}

// Launch picker
pickSingleMedia.launch(PickVisualMediaRequest(PickVisualMedia.ImageOnly))

The manifest entry you showed is no longer needed. The new ActivityResult API handles photo picking across API levels automatically.

please let me know if still you are in problem. Thanks

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • RegEx Blacklisted phrase (2.5): please let me know
  • Long answer (-1):
  • Has code block (-0.5):
  • High reputation (-1):
Posted by: Tanim reja