0

I am making an app and I wanna share images from my app to a specific app

so i used this code to share via choose

try {
    Intent sharingIntent = new Intent(Intent.ACTION_SEND);

    // path of image
    final String imageURIPath = "image-path";
    Uri imageURI = Uri.parse(imageURIPath);

    sharingIntent.setType("image/jpeg");
    sharingIntent.setType("image/jpg");
    sharingIntent.setType("image/png");
    sharingIntent.putExtra(Intent.EXTRA_STREAM, imageURI);
    startActivity(Intent.createChooser(sharingIntent, "Share via app"));
} catch (Exception e) {
    showMessage(e.toString());
}

and all work perfectly but I need to share to a specific app like this

shareIntent = getPackageManager().getLaunchIntentForPackage("app_PackageName");
startActivity(shareIntent);

so 'app_PackageName' chage to like app what i need like this example

shareIntent = getPackageManager().getLaunchIntentForPackage("com.adobe.lrmobile");
startActivity(shareIntent);

and I build the app without errors but when I wanna share to that app it just opens that app

Ankur Lahiry
  • 2,253
  • 1
  • 15
  • 25
SamilYT
  • 46
  • 3
  • Have a look at this post: https://stackoverflow.com/questions/6827407/how-to-customize-share-intent-in-android/9229654#9229654 If you also develop the app you want to share with you can create an intent filter in that app which receives data from your another app. – memres Jun 15 '22 at 05:42
  • @memres thanks i will try this one soon as possible – SamilYT Jun 15 '22 at 10:54

0 Answers0