input-samples
input-samples copied to clipboard
Whatsapp is not supported
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?
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.
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 :)
Sorry, I didn't see your answer. Thanks a lot, I will test this code.
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 :(
Another thing, I converted the images to gif, and the whatsapp return the message "The format its not supported". Jesus Christ.....
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??
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.
Guys, you must override and correctly implement method ContentProvider.getType()