Rocket.chat.reactnative: Can't save pictures on Android 10

Created on 10 Sep 2020  路  12Comments  路  Source: RocketChat/Rocket.Chat.ReactNative

Description:

Android 10 devices get an error while trying to save pictures from chat. Looks like an album creation fails https://github.com/react-native-community/react-native-cameraroll/issues/115

Environment Information:

  • Rocket.Chat Server Version: 3.6.0
  • Rocket.Chat App Version: 4.10.0
  • OS Version: Android 10

Steps to reproduce:

  1. Go to any room which has messages with pictures
  2. Open the picture and click the download button
  3. Give the permission to access media on your device

Expected behavior:

The picture should be saved to the device's gallery

Actual behavior:

Screenshot_2020-09-10-11-46-56-997_com autoxloo wx chat 1

Error while saving the picture

Additional context:

馃悰 bug

Most helpful comment

@diegolmello

This issue was introduced via https://github.com/RocketChat/Rocket.Chat.ReactNative/pull/2375, which would have broken version 4.10 and beyond for Android.

The fix is to opt out of scoped storage (https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage)

android:requestLegacyExternalStorage="true"

This is important to note for future changes to the targetSDK, as this workaround is no longer valid for 30+. You will need to follow this (https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage) to target anything further than you already are.

After setting the flag in the manifest, the only thing that I have noticed in terms of odd behavior is what the files are called, as they change once saved to gallery, as it no longer preserves the source name.

What is unexplainable is why some Android 10 devices mentioned above work just fine, and others just don't. Despite that unknown, saving images on my Note 20 have started working once again while debugging. The odd thing was in the emulator, it always worked to save the image (Android 11), even prior to making that change based on the 4.11.0 branch.

Please add to the 4.12.0 code that you are currently testing, and let's restore a functionality thats been broken for near 2 months.

All 12 comments

I would like to contribute to this bug, and I am also a first timer on open-source. 馃檮

@shobhi1310 Thanks, but we're working on a fix already.
There're other issues on good first issue label

Thanks!, I will look into those issues then.

My Xiaomi Mi 9 SE is on Android 10 QkQ1.190828.002
I did try couple versions - 4.7 and latest 4.11 - all fine, pictures was saved
Screenshot_2020-10-05-14-45-52-804_chat rocket reactnative

The problem is urgent.
I have compiled the application from the latest source code (master, develop, single-server) the problem is available. I downloaded assembly 4.11 from the application store - there is a problem.
Asus ZenFone6, Android 10 (Stock ROM).

The problem is urgent.
I have compiled the application from the latest source code (master, develop, single-server) the problem is available. I downloaded assembly 4.11 from the application store - there is a problem.
Asus ZenFone6, Android 10 (Stock ROM).

Please show permissions granted to RCRN app.

The problem is urgent.
I have compiled the application from the latest source code (master, develop, single-server) the problem is available. I downloaded assembly 4.11 from the application store - there is a problem.
Asus ZenFone6, Android 10 (Stock ROM).

Please show permissions granted to RCRN app.

Storage is permited.

1

Storage is permited.

It's still somehow device or vendor related
Screenshot_2020-10-19-11-00-08-885_com google android permissioncontroller
Screenshot_2020-10-19-11-02-30-261_com android settings
Screenshot_2020-10-19-10-59-51-682_chat rocket reactnative

The problem is urgent.
I have compiled the application from the latest source code (master, develop, single-server) the problem is available. I downloaded assembly 4.11 from the application store - there is a problem.
Asus ZenFone6, Android 10 (Stock ROM).

@Scorpio92 Contributions appreciated.

samsung s10e, Android 10, same problem.

@diegolmello

This issue was introduced via https://github.com/RocketChat/Rocket.Chat.ReactNative/pull/2375, which would have broken version 4.10 and beyond for Android.

The fix is to opt out of scoped storage (https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage)

android:requestLegacyExternalStorage="true"

This is important to note for future changes to the targetSDK, as this workaround is no longer valid for 30+. You will need to follow this (https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage) to target anything further than you already are.

After setting the flag in the manifest, the only thing that I have noticed in terms of odd behavior is what the files are called, as they change once saved to gallery, as it no longer preserves the source name.

What is unexplainable is why some Android 10 devices mentioned above work just fine, and others just don't. Despite that unknown, saving images on my Note 20 have started working once again while debugging. The odd thing was in the emulator, it always worked to save the image (Android 11), even prior to making that change based on the 4.11.0 branch.

Please add to the 4.12.0 code that you are currently testing, and let's restore a functionality thats been broken for near 2 months.

@diegolmello

This issue was introduced via #2375, which would have broken version 4.10 and beyond for Android.

The fix is to opt out of scoped storage (https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage)

android:requestLegacyExternalStorage="true"

This is important to note for future changes to the targetSDK, as this workaround is no longer valid for 30+. You will need to follow this (https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage) to target anything further than you already are.

After setting the flag in the manifest, the only thing that I have noticed in terms of odd behavior is what the files are called, as they change once saved to gallery, as it no longer preserves the source name.

What is unexplainable is why some Android 10 devices mentioned above work just fine, and others just don't. Despite that unknown, saving images on my Note 20 have started working once again while debugging. The odd thing was in the emulator, it always worked to save the image (Android 11), even prior to making that change based on the 4.11.0 branch.

Please add to the 4.12.0 code that you are currently testing, and let's restore a functionality thats been broken for near 2 months.

It's works. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

venkatasubramanis picture venkatasubramanis  路  5Comments

ggazzo picture ggazzo  路  6Comments

monarkh-karina picture monarkh-karina  路  4Comments

Prateek93a picture Prateek93a  路  6Comments

sd1998 picture sd1998  路  4Comments