cometchat / cometchat-uikit-android

Ready-to-use Chat UI Components for Android
https://www.cometchat.com
44 stars 26 forks source link

Voice Note File Not Found After recording Issue in Chat screen #5

Closed Nivs113 closed 3 years ago

Nivs113 commented 3 years ago

After Recording voice note the error message displays "No File Found. Please". I have checked in code. can you please check this. and this issue facing in Samsung Devices.

if (audioFileNameWithPath != null) startPlayingAudio(audioFileNameWithPath); else Toast.makeText(getContext(), "No File Found. Please", Toast.LENGTH_LONG).show();

darshanbhanushali commented 3 years ago

Hello @Nivs113,

We have updated our UI Kit and added a check for API 30 before creating a new directory. We suggest you to check with latest UI Kit library.

You can refer below link to check the changes we have added in Utils.java file

https://github.com/cometchat-pro/android-java-chat-ui-kit/blob/1e0d8da3260728d1d4797372f3d7ccba4ca470da/uikit/src/main/java/com/cometchat/pro/uikit/ui_resources/utils/Utils.java#L660

proveshapyne commented 3 years ago

Hi @Nivs113,

I hope this helped resolve the issue. Please do reach out to help@cometchat.com if you require further technical help.

Regards, Provesha

YahiaAngelo commented 3 years ago

It still doesn't work on Android 11, As both getExternalStorageDirectory() and getExternalStoragePublicDirectory() functions are deprecated.

So to solve that and as we don't need to save the audio recordings files to phone's storage just save it to cache directory. So the getOutputMediaFile() function will look like this:

public static String getOutputMediaFile(Context context) {
        String dir = context.getExternalCacheDir().getAbsolutePath() + "/";
        return dir + (new SimpleDateFormat("yyyyMMddHHmmss")).format(new Date()) + ".mp3";
}