1

I'm learning Kotlin by watching some tutorials on the internet. I tried to receive images in my app by going to Google and selecting "Share Image," but my app does not appear as an option.

I've searched for a solution on Google, YouTube, ChatGPT, StackOverflow, and Android Developers, but I haven't found a solution. Im using API 34.

Here is my manifest. As I understand it, I only need to add the <intent-filter> to receive images, right? I also checked if my app needs any permissions, which is why I included the <uses-permission> line. I looked in Settings -> App -> Permissions, but it was disabled. Lastly, I tried running my app on another AVD (API 33), but it didn't work.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Fundamentals"
        tools:targetApi="31">

        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
            </intent-filter>
        </activity>

        <activity
            android:name=".SecondActivity"
            android:exported="false">
        </activity>

    </application>

    <queries>
        <intent>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="text/plain" />
        </intent>
    </queries>
</manifest>
2
  • 1
    This looks good, I don't see a reason why that wouldn't work. Are you sure you are actually trying to share an image and not a link to an image? Also, on some devices it may not be obvious that the list of apps you can share an image with can be further scrolled down when only the first row of apps is displayed from the start. Are you sure your app isn't further down in the list of apps?
    – Leviathan
    Commented Jul 7 at 23:43
  • I made that to an answer because I'm pretty sure the Google app is misleading you in thinking you would actually send an image.
    – Leviathan
    Commented Jul 8 at 0:04

1 Answer 1

0

You code looks good to me, I think the problem is somewhere else.

When you use the Google app and long-press on an image you can select to share that image:

What you are actually sharing, though, is just a link to that image:

As you can see, the title says "Sharing link" and you can even see the link.

Links are just simple, plain text. If you want your app to receive such links you need to adjust your intent filter's data tag to this:

<data android:mimeType="text/plain" />

I don't think you can send actual images with the Google app, but you can try another app, like your camera. With the original intent filter your app should then appear as a target.

1
  • Thanks for the answer, that was it! I went back to the tutorial video that I watched and noticed that the website being used was not Google, but another image website with the same "Share Image" button. In that case, my app appears. I also added the <data android:mimeType="text/plain" /> in my manifest, and now the app shows up as an option in Google. Commented Jul 9 at 11:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.