Share from Gallery

niqpw

Member
Licensed User
Longtime User
There is the ability to select a photo in the Gallery, select 'Share', and an input list of options is displayed (facebook, email, twitter etc).

  1. How is it possible to add my app to this list
  2. If my item is added to the list and selected, how is that handled by my app?

Thanks for any help!
 

niqpw

Member
Licensed User
Longtime User
Thanks Erel for the speedy feedback, this would be a great feature! Do you have a rough idea of when the next update is going to be?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I cannot yet say.
I'm sorry but while thinking about the required feature again I'm not sure that it will be fully supported in the next version. You will be able to get the Intent that launched your application, however I don't think that it will be possible to provide content to other applications (as required by the gallery at least) in the next update..
 
Upvote 0

XverhelstX

Well-Known Member
Licensed User
Longtime User
hey there niqpw,

You can add your app to the "Share" list as following:

Go to the objects folder and open AndroidManifest.xml with dreamweaver or notepad or another text editor.
Locate the following text:

B4X:
<intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

and add this text under it.

B4X:
<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
</intent-filter>

This sets your application in the list of Share.
Note this line: <data android:mimeType="image/*" />
This will work on all image files. So if you go to a video and you select share, you won't see your app between it. But it's probably possible to add audio and video to it also.

What you shouldn't forget to do is right-click on your AndroidManifest.xml and select properties. and check the box read-only.

When compiling, the text won't be changed anymore, untill you uncheck it.
So the only way I recommend you to do this if when you have finished your app and wants to publish it.

Functions like the "share via" in Android work with broadcast intents. The app creates this intent and the system reports all the activities that can execute that.
You specify what an activity can do by means of intent filters.

Altough, I don't know how it's handled by the app itself.

Sincerely,
XverhelstX
 
Last edited:
Upvote 0

niqpw

Member
Licensed User
Longtime User
Thanks XverhelstX you beauty, that works! Just need to figure out if the next bit is doable.
 
Upvote 0
Top