question

ryokan-oshoh avatar image
ryokan-oshoh asked

How do I handle music player app on Kindle fire HD 7 from developing App?

How do you do, I'm YAMAMOTO who live in Osaka, JAPAN. I'm going to build new app on Kindle Fire HD 7. I want to handle standard music player on Kindle Fire HD 7 from the App when the App start. I think I prepare these package on Android. android.media.AudioManager; android.media.RemoteControlClient; I know that method "isMusicActive()" on AudioManager can get playing or not. But how do I build cording to handle this. I have no idea to complete these. Please provide me how do I these. Best Regards.
fire tablet
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
Hi YAMAMOTO , You want to get the default player coming up and playing use this: [i]String songPath = "/mnt/sdcard/Music/XXXXX/song1.mp3"; Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); File file = new File(songPath.toString()); intent.setDataAndType(Uri.fromFile(file), "audio/*"); startActivity(intent); [/i] or IF you want to play song in background use this [i]String songPath = "/mnt/sdcard/Music/XXXXX/song1.mp3"; try { MediaPlayer mMediaPlayer; mMediaPlayer = new MediaPlayer(); mMediaPlayer.setDataSource(songPath); mMediaPlayer.prepare(); mMediaPlayer.start(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }[/i] Hope this information helps
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ryokan-oshoh avatar image
ryokan-oshoh answered
Hi, Bipin I found the sample code named "RandomMusicPlayer" from Google. I'm going to confirm these source code. Best regards.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.