android-music-player

How to put media controller button on notification bar?

末鹿安然 提交于 2019-11-26 04:12:38
问题 I am creating a music player application. I want to show the media controller on notification bar while my application is running in background. It looks like Google player. How to do this? 回答1: For getting media player controller in your app simply follow this: Call this method in your MainActivity public void showNotification(View view){ new MyNotification(this); finish(); } Create a new MynotificationClass public class MyNotification extends Notification { private Context ctx; private

READ_EXTERNAL_STORAGE permission for Android

假如想象 提交于 2019-11-26 02:52:53
问题 I\'m trying to access media files (music) on the users device to play them; an easy \"hello world\"-music player app. I\'ve followed some tutorials and they basically give the same code. But it won\'t work; it keeps crashing and telling me: error..... Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/media from pid=27696, uid=10059 requires android.permission.READ_EXTERNAL_STORAGE, or

Android background music service

放肆的年华 提交于 2019-11-25 23:54:22
问题 I am developing an entertainment app in android. I want to play background music, and I want to use service for that. App have 3 activities and music must be played across all activities. Also, when activity is paused, music must PAUSE and stopped when destroyed. Can anyone tell me how to do this ? any links or examples ? Thank you. 回答1: Do it without service http://www.rbgrn.net/content/307-light-racer-20-days-61-64-completion If you are so serious about doing it with services using