Android 2.3: Music content providers for artists, albums and songs

by Daniel » Fri, 25 Feb 2011 21:45:47 GMT


Sponsored Links
 The activities ArtistAlbumBrowserActivity, AlbumBrowserActivity and
TrackBrowserActivity cannot be started anymore by an Intent (e.g.
using action.PICK and "vnd.android.cursor.dir/album") since the
attribute android:exported is set to "false" for those activities
since Android 2.3 (see
 http://android.git.kernel.org/?p=platform/packages/apps/Music.git ;a=blob;f=AndroidManifest.xml;h=90e0c5b9b81371a1b64940e432cd6917a530b2f4;hb=HEAD).
That is really annoying because the Intent stuff was once one of
Android's strength's and now you are not allowed to use this stuff any
more. That's a shame...

-- 



Re: Android 2.3: Music content providers for artists, albums and songs

by TreKing » Sat, 26 Feb 2011 03:11:58 GMT


 



Is (or was) it documented somewhere that this is the proper way to do this?

That is really annoying because the Intent stuff was once one of Android's

Intent stuff is still one of Android's strengths - when used correctly. It
looks like you were exploiting private implementation details to get this to
work. You should not be surprised that it has changed.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Re: Android 2.3: Music content providers for artists, albums and songs

by Daniel » Sun, 27 Feb 2011 04:26:23 GMT


 Well I don't think so. It was really cool to build apps like a mesh up
of activities others implemented.
I know a lot of developers who used exactly this intents and this
change really killed all of them. Only Google apps like "Search" are
still able to use these intents. This is not what I expect from an
open platform where 3rd party developers should be able to write apps
with the same quality as Google.
But ok if your argumentation goes that way, what shall I say, well
done my app is dead. I'm pretty sure others too.






-- 



Re: Android 2.3: Music content providers for artists, albums and songs

by Daniel » Sun, 27 Feb 2011 04:30:22 GMT


 Btw, the problem is not that something was changed (yes I know it was
not documented). But the platform lost some of its openness for 3rd
party developers.






-- 



Re: Re: Android 2.3: Music content providers for artists, albums and songs

by Dianne Hackborn » Sun, 27 Feb 2011 05:09:49 GMT


 he music app is an implementation detail; I don't do the app, but I assume
this was done because people shouldn't be relying on the implementation
detail of it being implemented as separate activities.

The media provider is still in the SDK, and is the same thing the media
application uses for this UI.

You can just copy the code you want and use it in your own activity.

This didn't "lose its openness" for third party developers in any way,
shape, or form. If you want to define openness that way, well then Linux
desktops aren't open because they don't allow apps to launch pieces of other
apps at all.

On Sat, Feb 26, 2011 at 12:30 PM, Daniel <daniel.himmel...@googlemail.com>wrote:




--
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails. All such
questions should be posted on public forums, where I and others can see and
answer them.

--



Re: Re: Android 2.3: Music content providers for artists, albums and songs

by Dianne Hackborn » Sun, 27 Feb 2011 05:10:39 GMT


 h also, the media app still does support the proper way to have it pick a
music track for you, through GET_CONTENT if audio/*.

On Sat, Feb 26, 2011 at 1:09 PM, Dianne Hackborn <hack...@android.com>wrote:



--
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails. All such
questions should be posted on public forums, where I and others can see and
answer them.

--



Re: Android 2.3: Music content providers for artists, albums and songs

by Daniel » Sun, 27 Feb 2011 05:32:25 GMT


 ello Dianne,

ah ok, I will try the GET_CONTENT with audio/*. But can I also use it
for artists and albums?
And yes ok, I can copy the code of your activities (I will try this
out now). But I would really appreciate to eat Google's dogfood here
and don't want to invent the wheel again by myself. I also think this
is not what the users expect from the Android platform, because maybe
my activity will be somehow different from Googles (maybe in future
versions) and the users will not understand why...

For me the intent stuff really makes up some of Android's modularity
and openness. Yes it is right that desktop Linux does not have this
feature. That's why I like Android much more than desktop Linux :-).
But I really don't want to start a flamewar on this topic. I simply do
not understand why these activities are not available anymore to 3rd
party developers. Maybe it is because of task stacks, but I don't
know.

Best regards,
Daniel

On 26 Feb., 22:10, Dianne Hackborn <hack...@android.com> wrote:

--



Re: Android 2.3: Music content providers for artists, albums and songs

by gizmomogwai » Sun, 27 Feb 2011 07:05:32 GMT


 Another observation, which could be a bug in the package manager:

I have also a small life-wallpaper (the infamous discomagic) which
starts "a" musicplayer with the intent:

  Intent intent = new Intent(Intent.ACTION_PICK);
  intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
  intent.putExtra(Constants.ALBUM, ...);
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
  startActivity(intent);

The funny thing is, that this leads also to a SecurityException (as
long as no other Application is installed that filters for this
intent).
When I install e.g. MixZing which also supports this intent I get the
regular ActivityChooser (with music and mixzing) and if I choose Music
it works.

Good or Bad?


-- 



Re: Re: Android 2.3: Music content providers for artists, albums and songs

by Dianne Hackborn » Sun, 27 Feb 2011 07:35:27 GMT


 On Sat, Feb 26, 2011 at 3:05 PM, gizmomogwai




That is a bogus Intent.  The definition for the PICK intent is that the data
URI is the location of the data from which to pick from; you do not specify
the MIME type because that is implied by the given data URI.

(Btw I think the old implementation of the music did do something with this
kind of Intent, but it is wrong, and is probably another reason why it is
explicitly not allowing it to be used like this.)

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 



Re: Re: Android 2.3: Music content providers for artists, albums and songs

by Dianne Hackborn » Sun, 27 Feb 2011 07:36:37 GMT


 t the end of the day, these are not documented in the SDK, the music app is
something vendors tend to replace and customize, and trying to use these
things in it is very likely to cause you problems across devices as they
don't behave the same (at all) as what you are assuming.

On Sat, Feb 26, 2011 at 1:32 PM, Daniel <daniel.himmel...@googlemail.com>wrote:




--
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails. All such
questions should be posted on public forums, where I and others can see and
answer them.

--



Re: Re: Android 2.3: Music content providers for artists, albums and songs

by gizmomogwai » Sun, 27 Feb 2011 14:11:47 GMT


 Ok ... I understand, that this Intent is not supposed to use that way.
My actual question now is, why the behavior of the system changes depending 
of the installed or not installed MixZing-App.
Case 1 (no MixZing):
- startActivity leads to an securityexception
Case 2 (with MixZing installed):
- startActivity opens up the ActivitiyChooser as usual (with Music and 
MixZing, because they both filter this intent).
- choosing the stock music player opens up the music.app with the album 
preselected (no securityexception).

thanks in advance

-- 



Re: Re: Android 2.3: Music content providers for artists, albums and songs

by Dianne Hackborn » Sun, 27 Feb 2011 15:27:39 GMT


 It is a bug that the activity choose allows activities to be launched from
itself instead of the original caller.  This will be fixed in a future
release.

On Sat, Feb 26, 2011 at 10:11 PM, gizmomogwai






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 



Re: Android 2.3: Music content providers for artists, albums and songs

by Daniel » Sun, 27 Feb 2011 21:14:20 GMT


 I would suggest these two intents for starting artist and album
activities on an Android device now. They also work for Android 2.3
and 3.0.
They do not look as good as the other activities build by Google but
they work :-).

For artists:
String query = "";
Intent intent = new Intent();
intent.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
query = artistName;
intent.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, artistName);
intent.putExtra(MediaStore.EXTRA_MEDIA_FOCUS,
MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE);
intent.putExtra(SearchManager.QUERY, query);
mContext.startActivity(intent);

For albums:
Intent intent;
String query = "";
intent = new Intent();
intent.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
query = albumName;
intent.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, albumName);
query = query + " " + artistName;
intent.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, artistName);
intent.putExtra(MediaStore.EXTRA_MEDIA_FOCUS,
MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE);
intent.putExtra(SearchManager.QUERY, query);
mContext.startActivity(intent);







-- 



Other Threads

1. is there any limitation on glTranslatef or vertex coordinate system?

Hello~ comrade!

I am developing opengl based application.
something mysterious happened.
I've tested it with simple triangle.

I moved triangle's x coordinate and I also moved coordinate system
itself using glTranslatef
It looks well before triangle's x coordination approach around 8100..
But when x coordination over around 8100, triangle disappear.

this is strange.

is there any limitation on glTranslatef or vertex coordinate system?

Here is my code:.

....
        private float zoom=-8020.0f;

        private float xt=-8000.0f;

        private float yt=-8000.0f;

        private float prevTouchedX;

        private float prevTouchedY;

        private float xrot=0;

        private float yrot=0;




        public ModelRenderer(GLSurfaceView v, Model m) {
                this.m=m;
                this.v=v;
                this.c=v.getContext();
        }

        @Override
        public void onDrawFrame(GL10 gl) {

                int w = v.getWidth();
                int h = v.getHeight();

                gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

                gl.glMatrixMode(GL10.GL_PROJECTION);
                gl.glLoadIdentity();
                gl.glViewport(0,0,w,h);
                GLU.gluPerspective(gl, 45.0f, ((float)w)/h, 1f, 1000f);

                gl.glMatrixMode(GL10.GL_MODELVIEW);
                gl.glLoadIdentity();

                xt-=1.0f;

                gl.glTranslatef(xt,yt,zoom);

                gl.glRotatef(xrot, 1, 0, 0);
                gl.glRotatef(yrot, 0, 1, 0);

                vertices[frame_ix].put(0,vertices[frame_ix].get(0)+1.0f);
                vertices[frame_ix].put(3,vertices[frame_ix].get(3)+1.0f);
                vertices[frame_ix].put(6,vertices[frame_ix].get(6)+1.0f);

                System.out.println(vertices[frame_ix].get(0));


                gl.glVertexPointer(3,GL10.GL_FLOAT, 0, vertices[frame_ix]);
                gl.glNormalPointer(GL10.GL_FIXED,0, normals);
                gl.glTexCoordPointer(2,GL10.GL_FIXED,0,texCoords);
                gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
                gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
                gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

                gl.glColor4f(1,0,0,1);
                gl.glBindTexture(GL10.GL_TEXTURE_2D, tex);
                gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);
                gl.glDrawElements(GL10.GL_TRIANGLES, verts, 
GL10.GL_UNSIGNED_SHORT,
indices);

                frame_ix = (frame_ix+1)%m.getFrameCount();
        }

....

-- 

2. sms messaging

hi... how to send an automatic scheduled sms ??

-- 

3. Activity Being Killed (onDestroy) on Orientation Change

4. about adb reject shell command

5. pocket empires online

6. Android Market place and certificate usag

7. How to properly implement ParcelFileDescriptor.openFile() method.