react-native-share: Can't share audio file on a real device

Steps to reproduce

  1. Try to share a local mp3 file on a real Android device.

Expected behaviour

Opens an app intent to share the selected file on all devices.

Actual behaviour

ON EMULATOR: Sharing works as expected.

ON ACTUAL DEVICES: An empty intent (with no file) is opened when shared with Gmail. Shows a toast message, “Sharing failed. Please try again” on all other apps (WhatsApp, Messenger etc).

Environment

  • React Native version: 0.59.9
  • React Native platform + platform version: Tested on Android Emulator (Oreo 8.0), Oppo F11 & Nokia 6 (both running Pie 9.0)

react-native-share

Version: 1.2.1

Code

let path = /storage/emulated/Audio/SomeTrack.mp3;

onShare = () => {
     Share.open({
         url: 'file://'+path,
         type: 'audio/mp3',
         failOnCancel: false
     });
};

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

@farshed share_download_path.xml file so it solved mine will may help you too