0

I want to share image to snapchat but giving me "Sorry! You can only share images and videos" I tried this code but doesnt work Android share image on snapchat

I have this intent

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("*/*");
    intent.setPackage("com.snapchat.android");
    int n = Integer.parseInt(number.getText().toString());
    Uri uri = Uri.fromFile(new File(db.getimage(n))); //This is retrieving the Uri path from DB
    intent.putExtra(Intent.EXTRA_STREAM, uri);
    startActivity(Intent.createChooser(intent, "Open Snapchat"));
James
  • 235
  • 1
  • 2
  • 10
  • `Uri.fromFile(new File(db.getimage(n))); //This is retrieving the Uri path from DB` Impossible. It should retrieve a file path from db as the File class works with file paths. But then.. we dont know which path that would be. Wrong way of putting a problem here. Further you should not use Uri.fromFile but FileProvider.getUriForFile. And if it is an image the type is probably image/jpeg. – blackapps Nov 06 '20 at 08:25
  • Possible if I already save the path to DB – James Nov 06 '20 at 12:51

2 Answers2

0

the type that you are setting for the setType method is not correct, if you want to support any format of Image, I suggest you first get the format of Image And after that pass the correct parameter to the setType() method.

for getting a file extension you can use this link: link

0

For sharing data in snapchat, there is a kit available in their official website called Creative Kit.

Also you can find the Doc and Tutorials here.

Suraj Gupta
  • 879
  • 7
  • 6