[Q] MediaServiceConnection on Gingerbread - Android Software Development

I am looking to control the stock Android music player (I want to launch a particular song using the default music player) using my application.
Stuff that used to work on Android doesn't work on Gingerbread, with the error: "Not allowed to bind to service Intent { cmp=com.android.music/.MediaPlaybackService }"
From my research, I have found that this interface is not exported. Is there any other way I can launch the default media player with a track (or interrupt it and play another one)? I know it isn't official, but since widgets like Pure Music Widgets do this, I know it must be possible (or do they simulate bluetooth media buttons?) and this is XDA, anything is possible here
My apologies if this question has been asked and answered, could you please just point me to that thread. I searched and searched, but I couldn't find anything along these lines.

This was just posted yesterday:
http://forum.xda-developers.com/showthread.php?t=1040848

Thanks, I did see that but that's not what I'm looking for. I want to play music using the default music app/service, not play music inside my own app.
Sent from my HTC HD2 using XDA Premium App

Code:
Intent audioIntent = new Intent();
audioIntent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File("/mnt/sdcard/your/music/file.mp3");
audioIntent.setDataAndType(Uri.fromFile(file), "audio/*");
startActivity(audioIntent);
OR
Code:
Intent audioIntent = new Intent();
audioIntent.setAction(android.content.Intent.ACTION_VIEW);
Uri externalUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
//audioID is the id of the audio file in the database
Uri auidoUri = ContentUris.withAppendedId(externalUri, audioID)
audioIntent.setDataAndType(auidoUri, "audio/*");
startActivity(audioIntent);
The second method will let the user see the artist info/album art/etc (stored in the db), the first will let them play the song but all the info will be blank. You need to get the audio ID for the file from the MediaStore Content Provider if you want to use the second method though.

ananthb said:
Thanks, I did see that but that's not what I'm looking for. I want to play music using the default music app/service, not play music inside my own app.
Sent from my HTC HD2 using XDA Premium App
Click to expand...
Click to collapse
Also, what Gene Poole posted was correct, it would start the default video player, not his own app.

Perhaps I didn't explain what I wanted clearly enough.
I would like my app to start the default music player, make it play a song and quit (itself, not the default music player). When I use the code above, I see a black screen with a trackbar and the music stops playing when my application quits. That's not what I had in mind.
Screenshot of what happens when I use that code is:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}

is that honeycomb?

Nope, that's my HD2 running CM7 with tablet tweaks.
Sent from my HTC HD2 using XDA Premium App

Well that's not the stock music player from what I can tell. Or there is something else wrong there. The code posted for you was correct, something in your modded phone is causing it to show up like that.

Related

Looking for a simple Music Player App

I want a good old music player, something like WinAmp or alikes
I just want to click on a folder and play everything on the folder, instead of having to annoyingly having to go manually pick from Artist list, or Genre list, or Album list
so far all the Player software i've tested are like that "fancy wannabe"
Build in Samsung musci player = good player but lacks the most basic feature
Astro Player = it doesn't do it
bTunes = it doesn't do it
Rock Player = it doesn't do it
DAAP Media Player = it doesn't do it
Zimly Media Player = fancy but it doesn't do it
Vanilla Music Player = not as vanilla as it claims, it doesn't do it
MixIng = horrible junk
Kiss = it doesn't do it
.... (many hours later)
Player = woooooohoooooooo finally this one works the way i like, best thing is it also lets you set which ever tune you are listening to as the default ring tone, YES!
it can get lyrics too!
http://www.appbrain.com/app/com.aka.player
Simply Music works for me
Tried Lithium Music Player? Anyhoo ain't it cool us droid ppl have so many choices
Sent from my GT-I9000 using Tapatalk
MORT PLAYER = Folder Play
Pain in the ass when all your audio files get mixed in there... Folder Play=Yay!
Sent from my GT-I9000M using XDA App
There are a lot of windows utils out there that automatically create a playlist in every music folder you have.... So, you can still use your favorite player and click a "folder", but this time as a playlist (with the folder name as its name)
have you tried double twist?
appelflap said:
There are a lot of windows utils out there that automatically create a playlist in every music folder you have.... So, you can still use your favorite player and click a "folder", but this time as a playlist (with the folder name as its name)
Click to expand...
Click to collapse
problem is i have over 500+ folders to go trough even if i have to create 1 play-list for each folder.... too much work
the one i'm using right now "Player" is pretty good, it has select all folders, and play all selected
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
AllGamer said:
problem is i have over 500+ folders to go trough even if i have to create 1 play-list for each folder.... too much work
...[/IMG]
Click to expand...
Click to collapse
There are tools that will automatically create playlists for all your folders at once, with one click on a button so to speak. For example: http://www.softpedia.com/get/Multimedia/Audio/Other-AUDIO-Tools/Winamp-Playlist-Creator.shtml
But i know that there are many others out there.

WP7/Zune Style Android Music Player (Proof of Concept) - AppInventor

This is my first app showing a proof of concept WP7/Zune themed music player app for android built using AppInventor. I've heard there is a better one being made not on AppInventor (TheRedDrake), but it was just a proof of concept, and i wanted to experiment on AppInventor.
Also, can you do much more on AppInventor? Because i'm not sure if you can access files or not at the moment, and do much else - the music files are embedded in the app at the moment. Anyways, tell me what you think of the app, and if appinventor can access files or not, and if it is worth to keep trying things in appinventor. Thanks!
(App works fine on Samsung Galaxy S i9000) (Both music tracks in the app work)
App Download Link: dl.dropbox.com/u/13439948/ZunePlayerHD.apk
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
......
Appinventor is limited because there is no Java coding support. Yes you can make a music app but that's all. No zune software compability. Yes you can try going on but I suggest going to Java development.
So there is no real way of automatically creating a list of music files from a phone and putting them into the app through app inventor?
Also what would be the best way to start going into java development? Im relatively New to it, but i do know about eclipse and such, just not java or actual coding and development. Thanks.
Sent from my GT-I9000 using XDA App
P.s. has anyone tried the app yet?
Also im thinking of maybe adding internet radio functionality to it (to see just if it would work), and with album art etc, if AppInventor would permit it...
The link doesn't work
Xda app
download link fixed
Tried your app and again I got assured of the limitations of appinventor. Go to the official android developer page. Everything you need is there. There is another dev wanting to develop a zune player contact him and work together, he has a post on my thread. If you both agree you can take part in my project.
Xda app

Music on Lockscreen

Hey guys,
Is there a widget/app that will allow me to control my music from the lockscreen? Specifically, I want previous, pause, and forward controls. The rest of the screen should be occupied by the cover art as much as possible.
A good example of what I am looking for can be found using the default Music Player on HTC Sense. The only problem with the default player is that on the lockscreen the album art looks blurry (but not so in other apps). So esentially, I am looking for a replacement.
I am currently using PlayerPro but I want the album art to cover the whole screen which it does not do... (or as much as possible instead of being constrained in a square as it currently is).
Thanks.
Winamp has a lockscreen player which looks like
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
dunno if thats what you're looking for or if thats exactly how PlayerPro does it (never tried it), but it suits me just fine
Winamp looks promising, I'll try it out and let you know.
DoubleTwist player gives you lockscreen music control.
CM6 (and Im assuming CM7) has simple previous track, play/pause, and next track buttons if you use the default music player.
If you use a cynageon mod rom I think there is a setting in cmsettings to do so, aswell as (like you said) the htc sense one but also miui has good lockscreen controls
Check out poweramp. Really nice lock screen widget.
Sent from my T-Mobile G2 using XDA App
Widgetlocker replaces your lockscreen and you can customize to your like. Its what I use and its pretty cool. Put some widgets or shortcuts on there for quick access from the lockscreen. Highly recommend.
Sent from my HTC Vision
Well I'm looking for something that occupies the entire screen with album art (when locked) and still maintains a swipe to unlock feature. It's difficult to find this. The problem with WiidgetLocker is that I only want the music to appear on the lock screen when its playing (and not every time).
Or, if anyone knows how to make the default HTC Android Music player from displaying blurry/pixellated album art, let me know

[GUIDE] Fixing music player splitting up Albums

When you put music on your phone the music player sometimes splits up the albums like this: (not my screenshot, credit to styckx)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I am not responsible for anything this may do to your phone, or your music (although nothing should happen to it)
This is how to fix it, simply without having to edit song on PC:
1. Go to settings > applications > media storage and tap "Clear Data"
2. Install ZduneX25's epic port of the Honeycomb music player (may work with Gingerbread player, not tried, can someone try and skip this step) from here:
On ZDuneX25's deviantART (install by replacing Music.apk in /system/app with it with root explorer, changing its permissions to rw-r--r-- and rebooting.
3. Open the music app and it should be sorted (worked for me)
Done!
If you want the CM7 music app's apk to copy back to /system/app as above you can download it here
If this is happening it is because the id3 tags are different somehow. You are better off just using a program to fix it.
Sent from my ADR6350 using Tapatalk
kingsway8605 said:
If this is happening it is because the id3 tags are different somehow. You are better off just using a program to fix it.
Sent from my ADR6350 using Tapatalk
Click to expand...
Click to collapse
They're exactly the same and this process sorts it. Also, a program takes ages!
Sent from my GT540 using XDA App
I just use mp3tag on the PC. The ui is a little confusing but you can actually match the songs with the tags from amazon including embedded album art. Takes some time but my music is now perfect on every device I put it on. I have noticed Google music loses some of the metadata when uploading for some reason. I have to always re-enter the album artist for some reason.
Sent from my Transformer TF101 using Tapatalk

Glitch for Changing Artist Name on HTC Sense Music Player?

I have two songs that I want to change the artist name to reflect a change in letter casing. At first, I had these two songs downloaded from the gtunes music downloader app, but after discovering that the files were 128kbps, I had deleted them, although I did change the file name a day or two before deleting it. I imported these songs later on, but with a higher bit rate. The album art, song title, and album title were tagged on each song, but the artist name did not change (All the changes just involved capitalizing the artist and song tile). The file name, however, is the same as it was when I deleted it. Since noticing this problem, I have used multiple tag editing apps from the Play Store, but the HTC Sense music player does not reflect the change, nor does other local music playback apps like doubleTwist.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I hope the image helps....just hoping to capitalize that first letter of the artist on the music player lol
Is one of the apps you've tried iTag? It almost always works for me.
Sent from my NexusHD2
Nigeldg said:
Is one of the apps you've tried iTag? It almost always works for me.
Sent from my NexusHD2
Click to expand...
Click to collapse
I used iTag, DroID3Tagger, and AudioTagger (correct me on the name if I'm wrong). In all those apps, it appears capitalized. Even when I view the two files in Windows Explorer, it's how I want it to be. Still, it doesn't match up on the music player.
Try clearing the cache and data (unless you have playlists) of the music player. It's a long shot, but perhaps the changes you've made haven't come into effect yet?
I tried those options, but there's no luck. Still the same typing on both artists...my best hypothesis on this music player right now is that it
must have some kind of cache deep in the storage that won't let me change it
Sent from my HTC HD2 using xda app-developers app

Categories

Resources