S sorex Expert Licensed User Longtime User Sep 7, 2012 #1 Hello, Is there a way to execute Android's default mediaplayer to select a music track and get back to my app by pressing back the back button? (Endomondo does this by the way) I searched the forum and could find the mediaplayer example but that's for a single track play, invoking the default player would provide me track advance/pause/restart/file selector etc without the need to code all that in my app. I know I can quit my app via the home button and go to applications > mediaplayer but a simple button that shortcut's this would be neat.
Hello, Is there a way to execute Android's default mediaplayer to select a music track and get back to my app by pressing back the back button? (Endomondo does this by the way) I searched the forum and could find the mediaplayer example but that's for a single track play, invoking the default player would provide me track advance/pause/restart/file selector etc without the need to code all that in my app. I know I can quit my app via the home button and go to applications > mediaplayer but a simple button that shortcut's this would be neat.
NJDude Expert Licensed User Longtime User Sep 7, 2012 #2 Is this what you're looking for? Code: Copy Dim i As Intent i.Initialize ("", "") i.SetComponent("com.google.android.music/com.android.music.activitymanagement.TopLevelActivity") StartActivity(i) Upvote 0
Is this what you're looking for? Code: Copy Dim i As Intent i.Initialize ("", "") i.SetComponent("com.google.android.music/com.android.music.activitymanagement.TopLevelActivity") StartActivity(i)
S sorex Expert Licensed User Longtime User Sep 7, 2012 #3 dunno, never worked with such code. let me try this... Upvote 0
NJDude Expert Licensed User Longtime User Sep 7, 2012 #4 If that doesn't work, then try this: Code: Copy Dim i As Intent i.Initialize("android.intent.action.MUSIC_PLAYER", "") StartActivity(i) Upvote 0
If that doesn't work, then try this: Code: Copy Dim i As Intent i.Initialize("android.intent.action.MUSIC_PLAYER", "") StartActivity(i)
S sorex Expert Licensed User Longtime User Sep 8, 2012 #5 that didn't work either it spits out this error... ActivityNotFoundException:No activity found to handle Intent {act=android.intent.action.MUSIC_PLAYER flg=0x20000 } Upvote 0
that didn't work either it spits out this error... ActivityNotFoundException:No activity found to handle Intent {act=android.intent.action.MUSIC_PLAYER flg=0x20000 }
NJDude Expert Licensed User Longtime User Sep 8, 2012 #6 I really don't know why is not working for you, I have tried that code on all my devices which ranges from Froyo to Jelly Bean and it works. Upvote 0
I really don't know why is not working for you, I have tried that code on all my devices which ranges from Froyo to Jelly Bean and it works.
S sorex Expert Licensed User Longtime User Sep 8, 2012 #7 my device is such small Samsung Galaxy Apollo 5800, in some countries it's called Galaxy mini 5800 or something. I added a button, and put those lines in it's click event, do I need to add something in that manifest to make it working? Can you attach your example? Last edited: Sep 8, 2012 Upvote 0
my device is such small Samsung Galaxy Apollo 5800, in some countries it's called Galaxy mini 5800 or something. I added a button, and put those lines in it's click event, do I need to add something in that manifest to make it working? Can you attach your example?
Erel B4X founder Staff member Licensed User Longtime User Sep 9, 2012 #8 You should use PhoneIntents.PlayAudio. It is better than explicitly specifying the target activity. Upvote 0
S sorex Expert Licensed User Longtime User Sep 9, 2012 #9 you mean like this? Code: Copy Dim i As Intent i.Initialize("PhoneIntents.PlayAudio", "") StartActivity(i) fails aswell Upvote 0
you mean like this? Code: Copy Dim i As Intent i.Initialize("PhoneIntents.PlayAudio", "") StartActivity(i) fails aswell
NJDude Expert Licensed User Longtime User Sep 9, 2012 #10 Like this: Code: Copy Dim p As PhoneIntents StartActivity(p.PlayAudio(File.DirDefaultExternal, "Tune.mp3")) You need to reference the Phone library. Last edited: Sep 9, 2012 Upvote 0
Like this: Code: Copy Dim p As PhoneIntents StartActivity(p.PlayAudio(File.DirDefaultExternal, "Tune.mp3")) You need to reference the Phone library.
S sorex Expert Licensed User Longtime User Sep 9, 2012 #11 ok, but then I need to code my file selector, retrieve directory to advance tracks etc. I wanted to avoid that by using that default player. Upvote 0
ok, but then I need to code my file selector, retrieve directory to advance tracks etc. I wanted to avoid that by using that default player.
S sorex Expert Licensed User Longtime User Sep 10, 2012 #12 Erel: Do you have any idea how to get this working? We tried to figure out how Endomondo does it with some intent tracker, but that didn't bring up anything new. Upvote 0
Erel: Do you have any idea how to get this working? We tried to figure out how Endomondo does it with some intent tracker, but that didn't bring up anything new.
Erel B4X founder Staff member Licensed User Longtime User Sep 11, 2012 #13 You can use ContentChooser to let the user choose an audio file. Upvote 0
S sorex Expert Licensed User Longtime User Sep 11, 2012 #14 you mean there is no general option to use the built-in player so I have to write it all myself (including that ContentChooser as file selector)? Upvote 0
you mean there is no general option to use the built-in player so I have to write it all myself (including that ContentChooser as file selector)?
Informatix Expert Licensed User Longtime User Sep 11, 2012 #15 sorex said: you mean there is no general option to use the built-in player so I have to write it all myself (including that ContentChooser as file selector)? Click to expand... Not all. There are the MediaBrowser library and the FileExplorer class. Upvote 0
sorex said: you mean there is no general option to use the built-in player so I have to write it all myself (including that ContentChooser as file selector)? Click to expand... Not all. There are the MediaBrowser library and the FileExplorer class.