What is the purpose of this field?
To give you the metadata for the component, as specified by <meta-data>
elements in the manifest.
When should we use it
When you want to access the contents of the <meta-data>
elements.
do we really need it ?
If you have <meta-data>
elements, yes. Otherwise, no.
what is the meaning of just using 0 as the flags? will it get all of the apps?
It always gets "all of the apps". What the flags control is what data about those apps it retrieves. I assume this is to minimize the amount of data transferred over IPC in response to these calls, but that's just an educated guess.