O'Reilly logo

React Native Cookbook by Crysfel Villa, Stan Bershadskiy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing audio files on Android

A benefit that Google likes to claim that Android has over iOS is flexibility in dealing with file storage. Android devices support external SD cards that can be filled with media files, and do not need a proprietary method of adding multimedia as iOS does.

In this recipe, we will use Android's native mediaPicker, which is started from an intent. We will then be able to pick a song and have it play through our application.

Getting ready

For this recipe, we created a React Native application titled AudioPlayer.

In this recipe, we will use the react-native-button library. To install it, run the following command in the terminal from your project root directory:

$ npm install react-native-button --save

Make sure you have ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required