input-samples icon indicating copy to clipboard operation
input-samples copied to clipboard

Whatsapp is not supported

Open regiszanandrea opened this issue 7 years ago • 9 comments

Hi,

I'm developing a custom keyboard that have to send images to Messenger and Whatsapp conversasions. So, I called the function isCommitContentSupported(...,MIME_TYPE_PNG) on Whatsapp and returned false, and a called the same function on Messenger app and returned true. The Commit Content is not supported on Whatsapp.

Anybody can help? There is an alternative?

regiszanandrea avatar Jun 13 '17 13:06 regiszanandrea

Hello! I was trying to do the same thing, my solution was to convert the image file to gif and then send it. Whatsapp does support sending gif. Hope this help.

LeonardooBorges avatar Jul 28 '17 19:07 LeonardooBorges

Hi Leonardo,

Can you paste your code here? Or email me ? [email protected]

Thanks.

regiszanandrea avatar Jul 29 '17 14:07 regiszanandrea

private File convertToGif(File imageFile) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    AnimatedGifEncoder encoder = new AnimatedGifEncoder();
    encoder.start(bos);
    encoder.addFrame(BitmapFactory.decodeFile(imageFile.getAbsolutePath()));
    encoder.finish();
    byte[] array = bos.toByteArray();

    // Save to file
    File output = new File(Environment.getExternalStorageDirectory(), "output.gif");
    FileOutputStream fos = new FileOutputStream(output.getPath());
    fos.write(array);
    fos.close();
    return output;
  }

And I use this code https://gist.github.com/wasabeef/8785346

Any questions you have I can try to help :)

LeonardooBorges avatar Jul 31 '17 14:07 LeonardooBorges

Sorry, I didn't see your answer. Thanks a lot, I will test this code.

regiszanandrea avatar Aug 10 '17 18:08 regiszanandrea

Hi @LeonardooBorges, how do you pass to the doCommitContent the file? I'm getting a error, but I can't tracking the erro by the logcat :(

regiszanandrea avatar Aug 11 '17 12:08 regiszanandrea

Another thing, I converted the images to gif, and the whatsapp return the message "The format its not supported". Jesus Christ.....

regiszanandrea avatar Aug 11 '17 12:08 regiszanandrea

Yes, I am facing the same issue. "The file format is not supported". Have followed the sample, have 3 buttons for gif, png and webp. While nothing happens on clicking png and webp, gif throws "the file format not supported" error.

Any help??

prashantvr avatar Oct 29 '17 08:10 prashantvr

I am having the same issue here. The pngs/gifs are working fine in fb messenger & google hangouts, but not whats app or even the native message app. GIF or not does not allow it. The sample app is flawed as a demo. I am thinking to make a copy paste functionality here, and make use of the clipboard as I have on the ios version.

diskrim avatar Dec 20 '17 20:12 diskrim

Guys, you must override and correctly implement method ContentProvider.getType()

ok3141 avatar Jun 04 '18 13:06 ok3141