Android Question Share images with specific apps

adriano.freitas

Active Member
Hello!

I'm creating an app that needs to share images, however, this sharing should only occur for some specific applications (facebook, instagram, linkedin and whatsapp). I've seen several commercial applications that, when sharing an image, limit those who can receive the image. How to do this?
 

asales

Expert
Licensed User
Longtime User
You cannot filter only this applications use the intent chooser.
You need to create your own screen to share (and use the intents to every app), like this:
1680616371270.png
 
Upvote 0

asales

Expert
Licensed User
Longtime User
An example to share an image using the Instagram:
B4X:
Dim inten As Intent
inten.Initialize(inten.ACTION_SEND,"")
inten.SetType("image/*")
inten.PutExtra("android.intent.extra.STREAM", Starter.Provider.GetFileUri("myimage.jpg"))
inten.SetPackage("com.instagram.android")
StartActivity(inten)
This is similar to others apps and there are a lot of code show how to share in the forum.
 
Upvote 0

adriano.freitas

Active Member
An example to share an image using the Instagram:
B4X:
Dim inten As Intent
inten.Initialize(inten.ACTION_SEND,"")
inten.SetType("image/*")
inten.PutExtra("android.intent.extra.STREAM", Starter.Provider.GetFileUri("myimage.jpg"))
inten.SetPackage("com.instagram.android")
StartActivity(inten)
This is similar to others apps and there are a lot of code show how to share in the forum.

Wonder! Thank you very much indeed for the help. I'm new to mobile programming and you helped me a lot! I'm going to implement it... So there's no way to create a list of packages to receive (showing the user a list of the desired ones when sharing, right?)
 
Upvote 0

asales

Expert
Licensed User
Longtime User
So there's no way to create a list of packages to receive (showing the user a list of the desired ones when sharing, right?)
Not in the easy way. You can try this Java codes:


 
Upvote 0
Top