Is there any way we can read/parse android manifest file as we do it for files in raw folder as mentioned here:
http://eagle.phys.utk.edu/guidry/android/writeSD.html
As already suggested, you can use the PackageManager
for this purpose. There are several methods that are able to return one or more PackageInfo
objects, which on their turn contain a public field ActivityInfo[] activities, provided you instruct it too... read below.
The documentation mentions the following:
Array of all tags included under , or null if there were none. This is only filled in if the flag GET_ACTIVITIES was set.
So make sure that you provide that particular flag when requesting the info; e.g. when using getPackageInfo(...), do:
getPackageInfo("your.package.name", PackageManager.GET_ACTIVITIES)
If you need to retrieve more details, you can 'or' multiple flags together:
getPackageInfo("your.package.name", PackageManager.GET_ACTIVITIES | PackageManager.GET_RECEIVERS)
Edit:
Alternatively you could also use the getActivityInfo(android.content.ComponentName, int) and catch the NameNotFoundException
that will be thrown if the requested Activity
cannot be found, but generally this is considered 'abusing' exceptions.
Anyways, up to you.
[Edit after OP's comment] : You can use Android's PackageManaer http://developer.android.com/reference/android/content/pm/PackageManager.html to get information about the contents of the manifest file that Android understands.